¿Ajuste en AUTOGET?

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Wed Mar 24, 2021 3:57 am

AIDA wrote:ahora si baja la lista y se sobre pone a cualquier cosa se pierde :cry:

se podrá arreglar si me gusto

Image

Saluditos :wink:


LA UNICA MANERA PARA QUE FUNCIONE ES

deshabilitar temporalmente los controles o imágenes
para que la lista baje y no se pierda PERO SI LE DOY CON DIFERENTES LETRAS SE PIERDE EL FOCO Y LA LISTA SE BORRA :shock:

Image
hosting full
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AngelSalom » Wed Mar 24, 2021 10:36 am

Hace un tiempo harto del mal funcionamiento de AUTOGET y basándome en esa clase con algunos ajustes creé la clase BROWSEGET con un funcionamiento idéntico pero de forma correcta :

tbrowseget.prg
Code: Select all  Expand view  RUN

/* CLASS: TBrowseGet
    Permite mostrar una lista de datos desplegable para seleccionar desde un get
*/


//TODO: Documentar

#include "fivewin.ch"
#include "browseget.ch"

#define COLOR_CAPTIONTEXT     9
#define BROWSEGETCODIGOCOLUMN   1
#define DEFAULT_GUI_FONT     17
#define BROWSEGETCODIGOCOLUMN   1
#define DATATYPE_HASH 256


CLASS TBrowseGet FROM TGet

   DATA nItemTextColor
   DATA nItemBackgroundColor

   DATA uDataSource
   DATA uOrgData
   DATA nDataType
   DATA xField
   DATA oList
   DATA bCreateList
   
   DATA nListHeight
   DATA nListWidth

   DATA bAdaptaGet

   METHOD New( ... )
   METHOD ReDefine( ... )

   METHOD CreateList( uDataSource )
   METHOD CloseList()

   METHOD KeyChar( nKey, nFlags )
   METHOD KeyDown( nKey, nFlags )

   METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos )

   METHOD SetList( uDataSource, xField )   INLINE  ::uDataSource := uDataSource, ::xField := xField

   METHOD ValidList() INLINE ( HB_ISOBJECT (::oList) )

END CLASS

//---------------------------------------------------------------------------//

METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, bValid,;
            nClrFore, nClrBack, oFont, lDesign, oCursor, lPixel, cMsg,;
            lUpdate, bWhen, lCenter, lRight, bChanged, lReadOnly,;
            lPassword, lNoBorder, nHelpId, lSpinner,;
            bUp, bDown, bMin, bMax, bAction, cBmpName, cVarName, cCueText,;
            uDataSrc, xField    , nListHeight,  nListWidth, bAdaptaGet, bCreateList,;
            nItemTextColor, nItemBackgroundColor  ) CLASS TBrowseGet

   DEFAULT xField      := BROWSEGETCODIGOCOLUMN
   DEFAULT nListHeight := 300
   DEFAULT nListWidth  := 500

   ::xField       := xField
   ::nListHeight  := nListHeight

   ::uDataSource  := uDataSrc
   ::bCreateList  := bCreateList
   
   ::SetList( uDataSrc, ::xField )

   ::nItemTextColor       := nItemTextColor
   ::nItemBackgroundColor := nItemBackgroundColor

   ::nListWidth   := nListWidth
   ::bAdaptaGet   := bAdaptaGet

   ::Super:New(nRow   , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
             cPict  , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
             oCursor, lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
             lRight , bChanged, lReadOnly, lPassword, lNoBorder, nHelpId,;
             lSpinner, bUp    , bDown    , bMin     , bMax )

return ( self )

//---------------------------------------------------------------------------//

METHOD ReDefine( nId,       bSetGet,  oWnd,    nHelpId, cPict,   bValid, nClrFore,;
                 nClrBack,  oFont,    oCursor, cMsg,    lUpdate, bWhen,  bChanged,;
                 lReadOnly, lSpinner, bUp,     bDown,   bMin,    bMax,   bAction,;
                 cBmpName,  cVarName, cCueText,;
                 uDataSrc, xField    , nListHeight,  nListWidth, bAdaptaGet, bCreateList,;
                 nItemTextColor, nItemBackgroundColor ) CLASS TBrowseGet

   DEFAULT xField     := BROWSEGETCODIGOCOLUMN
   DEFAULT nListHeight := 300
   DEFAULT nListWidth := 300

   ::xField       := xField
   ::nListHeight  := nListHeight

   ::uDataSource  := uDataSrc
   ::bCreateList  := bCreateList

   ::SetList( uDataSrc, ::xField )

   ::nItemTextColor       := nItemTextColor
   ::nItemBackgroundColor := nItemBackgroundColor

   ::nListWidth   := nListWidth
   ::bAdaptaGet   := bAdaptaGet

   ::Super:ReDefine( nId,       bSetGet,  oWnd,    nHelpId, cPict,   bValid, nClrFore,;
                   nClrBack,  oFont,    oCursor, cMsg,    lUpdate, bWhen,  bChanged,;
                   lReadOnly, lSpinner, bUp,     bDown,   bMin,    bMax,   bAction,;
                   cBmpName,  cVarName, cCueText )

return ( self )


METHOD CreateList() CLASS TBrowseGet

   If ! ::ValidList()

      if Len ( ::uDataSource ) > 0

        ::oList := TBrowseGetList():New( ::nListWidth, ::nListHeight, Self,;
                                         ::oFont, ::nItemTextColor, ::nItemBackgroundColor )
     
        ::oList:bAdaptaGet:=::bAdaptaGet
        ::oList:SetList( ::uDataSource, ::xField )

        if HB_ISOBJECT (::oList)

          ::oList:Paint()

        endif

        ::SetFocus()

      Endif

   Else

      ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )
      ::oList:SetList( ::uDataSource, ::xField )
     
      If Len ( ::oList:aData ) == 0
           
         ::uDataSource := ::uOrgData
         ::oList:end()
         ::oList = NIL
         
      Else
       
         ::oList:Refresh()
         ::SetFocus()

      Endif

   Endif

return ( nil )


METHOD CloseList() CLASS TBrowseGet
   
   if ::ValidList()

      ::oList:End()

   endif

return ( nil )  


METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos ) CLASS TBrowseGet

   local aPos := { nYPos, nXPos }

   if ::ValidList()

      if nDelta < 0

         ::oList:GoDown()

      else

         ::oList:GoUp()

      endif

   endif

return ( nil )


METHOD KeyDown( nKey, nFlags ) CLASS TBrowseGet

   if ::ValidList()

      switch nKey

         case VK_BACK

            ::CreateList()
            return ::Super:KeyDown( nKey, nFlags )
         
         case VK_LEFT
         
         case VK_RIGHT

            return ::Super:KeyDown( nKey, nFlags )
            exit
         
         case VK_DOWN

            ::oList:GoDown()
            exit
         
         case VK_UP

            ::oList:GoUp()
     
      endswitch
   
   else
     
      return ::Super:KeyDown( nKey, nFlags )
   
   endif

return ( 0 )

//---------------------------------------------------------------------------//

METHOD KeyChar ( nKey, nFlags ) CLASS TBrowseGet

   local nret

   switch nKey

      case VK_ESCAPE

         ::CloseList()
         return ::Super:KeyChar( nKey, nFlags )
     
      case VK_BACK

         nRet = ::Super:KeyChar( nKey, nFlags )

         if HB_ISOBJECT ( ::oGet )

            if Len ( Alltrim ( ::oGet:Buffer ) ) == 0

               ::CloseList()

            else

               ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )
               ::CreateList()

            endif
           
         endif

         return nRet

      case VK_RETURN

         if ::ValidList()
           
            eval ( ::oList:oBrowse:bChange )
            ::bValid := ::oList:bGetValid
            ::oList:End()
            ::oWnd:GoNextCtrl( ::hWnd )

         endif

      case VK_TAB

         if ::ValidList()
           
            eval ( ::oList:oBrowse:bChange )
            ::bValid := ::oList:bGetValid
            ::oList:End()
            ::oWnd:GoNextCtrl( ::hWnd )

         endif
         
         

      case VK_DOWN

         return ::Super:KeyChar( nKey, nFlags )

   endswitch

   nret = ::Super:KeyChar( nKey, nFlags )

   if ::oGet:Buffer != nil .and. Len ( Alltrim ( ::oGet:Buffer ) ) > 0

      ::uOrgData    := ::uDataSource
      ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )
     
      ::CreateList()

   endif

return ( nret )



CLASS TBrowseGetList

   DATA oDlgBrowse
   DATA oFont
   DATA oBrowse
 
   DATA lReleaseFont INIT .f.
 
   DATA nWidth
   DATA nHeight
 
   DATA uOrgValue
   DATA nDataType
   DATA aData
 
   DATA oGet
   DATA bAdaptaGet
   DATA bGetValid
 
   DATA bClrSel
   DATA bClrSelFocus
   DATA bClrStd
 
 
   METHOD New( nWidth, nHeight, oGet, oFont, nItemTextColor, nItemBackGroundColor )
   METHOD SetList( uDataSource, xField )
   METHOD Paint()
   METHOD Change()
   METHOD Refresh()
   METHOD GoUp()
   METHOD GoDown()
   METHOD End()
 
 END CLASS
 
 //---------------------------------------------------------------------------//
 METHOD New( nWidth, nHeight, oGet, oFont, nITemTextColor, nItemBackGroundColor ) CLASS TBrowseGetList
 
   ::nWidth   := nWidth
   ::nHeight  := nHeight
   ::oGet     := oGet
   ::oFont    := oFont
 
   DEFAULT nItemTextColor       := nRgb ("#333333")
   DEFAULT nItemBackGroundColor := nRgb ("#3399fe")
     
   ::bClrStd       := {|| { nITemTextColor, nRgb ( '#fffffd' ) } }
   ::bClrSel       := {|| { nRgb ( '#fffffd' ), nItemBackGroundColor  } }
   ::bClrSelFocus  := {|| { nRgb ( '#fffffd' ), nItemBackGroundColor  } }
 
   If ::oFont == nil
 
     ::oFont := TFont():New()
     ::oFont:hFont := GetStockObject( DEFAULT_GUI_FONT )
     ::lReleaseFont := .t.
 
   Else
 
     ::oFont := oFont
 
   Endif
 
 return Self
 
 
 METHOD SetList( uDataSource, xField ) CLASS TBrowseGetList
 
   local cType := ValType( uDataSource )
 
   DEFAULT xField := 1
 
   if cType == "A"
 
      ::nDataType = DATATYPE_ARRAY
      ::aData := ::oGet:uDataSource
   
   elseif cType == "H"
   
      ::nDataType = DATATYPE_HASH
      ::aData := ::oGet:uDataSource
 
   endif
 
   if HB_ISOBJECT ( ::oBrowse )
 
      ::oBrowse:SetArray ( ::aData )
 
   endif
 
 Return ( nil )
 
 
 METHOD Paint() CLASS TBrowseGetList
 
   Local aPoint
   Local nColumn
   
   aPoint :={ ::oGet:nTop + ::oGet:nHeight, ::oGet:nLeft }
   aPoint = ClientToScreen( ::oGet:oWnd:hWnd, aPoint )
 
   ::bGetValid       := ::oGet:bValid
   ::oGet:bValid     := nil
 
   DEFINE DIALOG ::oDlgBrowse OF ::oGet:oWnd STYLE WS_POPUP ;
                 SIZE ::nWidth, ::nHeight COLOR CLR_WHITE, CLR_WHITE
       
   ::oDlgBrowse:nStyle := nOr (WS_POPUP, WS_BORDER)                
   ACTIVATE DIALOG ::oDlgBrowse NOWAIT ;
                          ON INIT ::SetPos( aPoint[ 1 ] , aPoint[ 2 ] )
 
 
   @ 5, 5 XBROWSE ::oBrowse DATASOURCE ::aData AUTOCOLS  ;
         SIZE ::oDlgBrowse:nWidth - 10, ::oDlgBrowse:nHeight - 10  OF ::oDlgBrowse PIXEL FONT ::oFont NOBORDER
 
   WITH OBJECT ::oBrowse        
 
      :nMarqueeStyle       := 5
      :lRecordSelector     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.
      :lFastDraw           := .t.
      :lHScroll            := .f.
      :lVScroll            := .f.
      :lHeader             := .f.
      :lFlatStyle          := .t.
      :nStretchCol         := STRETCHCOL_WIDEST
      :lColDividerComplete := .t.
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :nMarqueeStyle       := MARQSTYLE_HIGHLROW
      :lRefreshOnlyData    := .F.
      :lReadOnly           := .t.
 
      :bClrStd       := ::bClrStd
      :bClrSel       := ::bClrSel
      :bClrSelFocus  := ::bClrSelFocus
 
      :CreateFromCode()
      :PostMsg( WM_SETFOCUS )
      :bKeyDown   := { | nKey | If( nKey == VK_RETURN .OR. nKey == VK_TAB, ::End() , ) }
      :bLButtonUp := { | nRow, nCol | (  Eval( ::oBrowse:bChange ),;
                                               ::End(),;
                                               ::oGet:oWnd:GoNextCtrl( ::oGet:hWnd ) ) }
   
      :bChange   := { ||  ::Change() }                                              
   
   END WITH
 
   WITH OBJECT ::oGet
 
      :oWnd:bMoved      := { || (  ::End() ) }
      :oWnd:bResized    := { || (  ::End() ) }
      :oWnd:bLClicked   := { || (  ::End() ) }
 
   END WITH
 
 Return ( nil )
 
 
 METHOD GoDown() CLASS TBrowseGetList
 
   ::oBrowse:GoDown()
 
 Return ( nil )
 
 
 METHOD GoUp() CLASS TBrowseGetList
 
   ::oBrowse:GoUp()
 
 Return ( nil )
 
 
 METHOD Change() CLASS TBrowseGetList
 
   ::oGet:VarPut( ::oBrowse:aCols[ ::oGet:xField ]:Value )
 
   if ::bAdaptaGet != NIL
     
      Eval ( ::bAdaptaGet )
 
   endif
 
   ::oGet:SetPos( Len ( Alltrim ( ::oGet:cText ) ) + 1 )
   ::oGet:Refresh()
 
 Return ( nil )  
 
 
 METHOD Refresh() CLASS TBrowseGetList
 
   ::oBrowse:Refresh()
 
 return ( nil )  
 
 
 METHOD End() CLASS TBrowseGetList
 
   if HB_ISOBJECT ( ::oBrowse )
 
      ::oBrowse:End()
 
   endif
 
   if HB_ISOBJECT ( ::oFont ) .and.;
     ::lReleaseFont
   
      ::oFont:End()
      ::oFont:=NIL
 
   endif
 
   if HB_ISOBJECT ( ::oDlgBrowse )
   
      ::oDlgBrowse:End()
 
   endif
 
   ::oGet:oList := nil
   ::oGet:bValid := ::bGetValid
 
 return ( nil )
 
 
 //-----------------------------------------//
 
 


browseget.ch
Code: Select all  Expand view  RUN

#ifndef _BROWSEGET_CH
#define _BROWSEGET_CH

#xcommand REDEFINE BROWSEGET [ <oGet> VAR ] <uVar> ;
             [ ID <nId> ] ;
             [ <dsrc: ARRAY, HASH, DATASOURCE> <uDataSrc> ];
             [ <fil: FILTERLIST, FILTER, LIST> <uFilter> ];            
             [ <dlg: OF, WINDOW, DIALOG> <oDlg> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ VALID   <ValidFunc> ]       ;
             [ <pict: PICT, PICTURE> <cPict> ] ;
             [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ FONT <oFont> ] ;
             [ CURSOR <oCursor> ] ;
             [ MESSAGE <cMsg> ] ;
             [ <update: UPDATE> ] ;
             [ WHEN <uWhen> ] ;
             [ ON CHANGE <uChange> ] ;
             [ <readonly: READONLY, NO MODIFY> ] ;
             [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
             [ ACTION <uAction> ] ;
             [ BITMAP <cBmpName> ] ;
             [ HEIGHTLIST <nListHeight> ] ;              
             [ CUEBANNER <cCueText> ] ;
             [ [ <fld: FIELD, COLUMN> ] <xField>] ;
             [ ITEMCOLOR <nColorTxt>[,<nColorSel>] ];              
             [ LISTWIDTH <nListWidth> ];
             [ ADAPTAGET <bAdaptaGet>];
       => ;
          [ <oGet> := ] TBrowseGet():ReDefine( <nId>, bSETGET(<uVar>), <oDlg>,;
             <nHelpId>, <cPict>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
             <oFont>, <oCursor>, <cMsg>, <.update.>, <{uWhen}>,;
             [ \{|nKey,nFlags,Self| <uChange> \}], <.readonly.>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}>, [\{|self| <uAction> \}], <cBmpName>, <"uVar">,;
             [<cCueText>], <uDataSrc>, ;
             <xField>, <nListHeight>, <nListWidth>,  <{bAdaptaGet}>,  [\{|uDataSource, cData, Self| <uFilter>\}],;
             <nColorTxt>[,<nColorSel>] )
                   
#command @ <nRow>, <nCol> BROWSEGET [ <oGet> VAR ] <uVar> ;
            [ <dsrc: ARRAY, HASH, DATASOURCE> <uDataSrc> ];
            [ <fil: FILTERLIST, FILTER, LIST> <uFilter> ];
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ <pict: PICT, PICTURE> <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ HEIGHTLIST <nListHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ CUEBANNER <cCueText> ] ;            
            [ [ <fld: FIELD, COLUMN> ] <xField>] ;
            [ ITEMCOLOR <nColorTxt>[,<nColorSel>] ];        
            [ LISTWIDTH <nListWidth> ];
            [ ADAPTAGET <bAdaptaGet>];
       => ;
          [ <oGet> := ] TBrowseGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, <.update.>, <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             .f., .f., <nHelpId>,;
             .f., , , , ,,, <"uVar">, [<cCueText>], <uDataSrc>, ;
             <xField>, <nListHeight>, <nListWidth> , <{bAdaptaGet}>,  [\{|uDataSource, cData, Self| <uFilter>\}],;
             <nColorTxt>[,<nColorSel>] )
             
#endif            

 


Ejemplo basado en testage5.prg del samples únicamente cambiando AUTOGET por BROWSEGET

Code: Select all  Expand view  RUN

#include "fivewin.ch"
#include "browseget.ch"

REQUEST DBFCDX

static lSeekWild := .t.

function main()

   field FIRST

   local oDlg, oGet, cName, cName1, cName2
   local oRs,  cAlias := "CUST"
   cName := space(20)

   USE CUSTOMER NEW ALIAS CUST SHARED VIA 'DBFCDX'
   INDEX ON UPPER(FIRST) TAG FIRST1 TO TMP MEMORY
   SET ORDER TO TAG FIRST1
   GO TOP

   define dialog oDlg title "Test BrowseGet" size 600, 300 pixel

   @ 1,2 BROWSEGET oGet var cName of oDlg ;
         DATASOURCE {};
         FILTER CUST->( ListFilter1( uDataSource, cData, Self ) );
         COLUMN 1 ;
         HEIGHTLIST 400

   @ 3,2 BUTTON "ok" OF odlg ACTION msgalert("Get 1:"+cName)
   @ 3,20 BUTTON "close" OF odlg ACTION odlg:end()

   activate dialog oDlg centered

return nil

//---------------------------------------------------------------------------//
// match case without case sensitive
function ListFilter1( aList, cData, oSelf )

   local aNewList := {}
   local cFor     := Upper( AllTrim( cData ) )
   local bFor

   if lSeekWild
      cFor     := '"' + cFor + '" $ UPPER(FIRST)'
   else
      cFor     := 'UPPER(FIRST)="' + cFor + '"'
   endif

   bFor     := &( "{ ||" + cFor + "}" )

   aNewList    := FW_DbfToArray( "FIRST", bFor )

RETURN aNewList

//---------------------------------------------------------------------------//


 



El resultado :

Image

Además al ser un browse lo que se despliega, como imaginarás las opciones se multiplican exponencialmente en cuanto al diseño, tipos de letra, múltiples columnas ... lo que se te ocurra.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Wed Mar 24, 2021 9:01 pm

Que bien
si el autoget es inestable :roll: ya estaba destripando su código :evil:
pero tu idea esta genial muchas gracias :mrgreen:

Muchas gracias :D


Saluditos. :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Wed Mar 24, 2021 9:05 pm

AIDA wrote:Que bien
si el autoget es inestable :roll: ya estaba destripando su código :evil:
pero tu idea esta genial.

muchas gracias :mrgreen:


Saluditos. :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Wed Mar 24, 2021 9:48 pm

AIDA wrote:
AIDA wrote:Que bien
si el autoget es inestable :roll: ya estaba destripando su código :evil:
pero tu idea esta genial.

muchas gracias :mrgreen:


Saluditos. :wink:


veo que es con una dbf entonces tendré que pasar todo esto a una dbf :shock:

Code: Select all  Expand view  RUN
marcas:= {{"ACADEMY",'AC'},{"ACCURATE MINIATURES",'AC'},{"AIRES",'AI'},{"AIRFIX",'AI'},{"AMATI",'AM'},{"AMT",'AM'},{"ARII",'AR'},{"AZTEK",'AZ'},;
          {"DRAGON",'DR'},{"ESCI",'ES'},{"FUJIMI",'FU'},{"GUILLOW'S",'GU'},{"GLENCOE",'GL'},{"HASEGAWA",'HA'},{"HELLER",'HE'},{"IDEA",'ID'},;
          {"IMEX",'IM'},{"ITALERI",'IT'},{"JOHAN",'JO'},{"LINDBERG",'LI'},{"LODELA",'LO'},{"LODELA AIRFIX",'LO'},{"LODELA HELLER",'LO'},{"LODELA-LEE",'LO'},;
          {"MATCHBOX",'MA'},{"MINICRAFT",'MI'},{"MONOGRAM",'MO'},{"MPC",'MP'},{"POLAR LIGHTS",'PO'},{"PZW",'PZ'},{"REVELL",'RE'},{"REVELL-GERMANY",'RE'},;
          {"REVELL-LODELA",'RE'},{"REVELL-MONOGRAM",'RE'},{"RUSLAND",'RU'},{"BOBCAT",'BO'},{"TAMIYA",'TA'},{"TESTOR",'TE'},{"TRUMPETER",'TR'},{"MIDWEST",'MI'},;
          {"MEGA-AIRFIX",'ME'},{"KP",'KP'},{"ICM",'IC'},{"AMMO",'AM'},{"VALLEJO",'VA'},{"EDUARD",'ED'},{"BRONCO",'BR'},{"GREAT WALL HOBBY",'GR'},;
          {"VERLINDEN",'VE'},{"AK",'AK'},{"SQUADRON",'SQ'},{"LS",'LS'},{"TRUE DETAILS",'TR'},{"AMK",'AM'},{"SMER",'SM'},{"AKAH",'AK'},{"JESUS ZHU",'JE'},{"MOTOR MAX",'MA'},{"BINKS",'BI'},;
          {"HOBBYBOSS",'HO'},{"TRUPER",'TR'},{"ENCORE_E_MODELS (SQUADRON)",'EN'},{"RODEN",'RO'},{"LODELA-KITECH",'LO'},{"KITECH",'KI'},{"DESCONOCIDA",'DE'},{"KINETIC",'KI'},{"DREAMMODEL",'DE'},{"MIG",'MI'},{"BEGEMOT",'BE'},;
          {"MISTER CRAFT HOBBY KITS",'MI'},{"REPLI-SCALE DECALS",'RE'},{"IWATA",'IW'},{"SERGAL",'SE'},{"ZOUKEI-MURA",'ZO'},{"PAVLA MODELS",'PA'},{"CYBER-HOBBY",'CY'},{"GOLD MEDAL MODELS",'GO'},{"PAASCHE",'PA'},{"KITTY HAWK",'KI'},{"LICONA",'LI'},;
          {"PLUS MODEL.CZ",'PL'},{"MODEL CHOICE",'MO'},{"SIN MARCA",'SI'},{"FREEDOM MODEL KITS",'FR'},{"INFINI",'IN'},{"KOTOBUKIYA",'KO'}}
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Wed Mar 24, 2021 10:05 pm

ME SALEN ERRORES :shock:

Code: Select all  Expand view  RUN
Compilando tbrowseget.prg...
tbrowseget.prg(13) Warning W0001  Redefinition or duplicate definition of #define BROWSEGETCODIGOCOLUMN
tbrowseget.prg(34) Error E0030  Syntax error: "syntax error at '...'"
1 Files, 1 Warnings, 1 Errors
Tiempo de compilación: 0.16s   Tiempo de enlazado: 0s   Tiempo total: 0.17s



ya revise todo y en ninguna parte uso la #define BROWSEGETCODIGOCOLUMN :(

con solo unir el tbrowseget.prg a mi programa al compilar sale ese error :shock:

NO QUIERO REGRESAR A USAR EL ABURRIDO Y ANTIGUO COMBO-BOX :cry:

YA LO RENOMBRE DE BROWSEGETCODIGOCOLUMN A BROWSEGETCODIGOCOLUMNX YA FUNCIONO PERO SOLO ME PERMITE UNA BUSQUEDA
SI ME RE SALGO DEL BROWSEGET Y REGRESO YA NO SALE LA LISTA EN UN SEGUNDO INTENTO, TAMBIEN SE PONE TRANSPARENTE COMO EL AUTOGET
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AngelSalom » Thu Mar 25, 2021 7:08 am

Por partes :
- El tipo de datos no es un DBF, BROWSEGET al igual que AUTOGET siempre maneja arrays, es la función que especifiques en la cláusula FILTER del BROWSEGET la que debe devolver el array adecuado para que la clase lo muestre. Aquí te pego el ejemplo testage2.prg adaptado a browseget (del samples de fivewin) que trabaja con un hash array, recuerda que lo importante es lo que gestiones en la función a la que llama FILTER :

Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "browseget.ch"

static aCountries := {;
  { "name" => "Afghanistan", "code" => 'AF'},;
  { "name" => "Åland Islands", "code" => 'AX'},;
  { "name" => "Albania", "code" => 'AL'},;
  { "name" => "Algeria", "code" => 'DZ'},;
  { "name" => "American Samoa", "code" => 'AS'},;
  { "name" => "AndorrA", "code" => 'AD'},;
  { "name" => "Angola", "code" => 'AO'},;
  { "name" => "Anguilla", "code" => 'AI'},;
  { "name" => "Antarctica", "code" => 'AQ'},;
  { "name" => "Antigua and Barbuda", "code" => 'AG'},;
  { "name" => "Argentina", "code" => 'AR'},;
  { "name" => "Armenia", "code" => 'AM'},;
  { "name" => "Aruba", "code" => 'AW'},;
  { "name" => "Australia", "code" => 'AU'},;
  { "name" => "Austria", "code" => 'AT'},;
  { "name" => "Azerbaijan", "code" => 'AZ'},;
  { "name" => "Bahamas", "code" => 'BS'},;
  { "name" => "Bahrain", "code" => 'BH'},;
  { "name" => "Bangladesh", "code" => 'BD'},;
  { "name" => "Barbados", "code" => 'BB'},;
  { "name" => "Belarus", "code" => 'BY'},;
  { "name" => "Belgium", "code" => 'BE'},;
  { "name" => "Belize", "code" => 'BZ'},;
  { "name" => "Benin", "code" => 'BJ'},;
  { "name" => "Bermuda", "code" => 'BM'},;
  { "name" => "Bhutan", "code" => 'BT'},;
  { "name" => "Bolivia", "code" => 'BO'},;
  { "name" => "Bosnia and Herzegovina", "code" => 'BA'},;
  { "name" => "Botswana", "code" => 'BW'},;
  { "name" => "Bouvet Island", "code" => 'BV'},;
  { "name" => "Brazil", "code" => 'BR'},;
  { "name" => "British Indian Ocean Territory", "code" => 'IO'},;
  { "name" => "Brunei Darussalam", "code" => 'BN'},;
  { "name" => "Bulgaria", "code" => 'BG'},;
  { "name" => "Burkina Faso", "code" => 'BF'},;
  { "name" => "Burundi", "code" => 'BI'},;
  { "name" => "Cambodia", "code" => 'KH'},;
  { "name" => "Cameroon", "code" => 'CM'},;
  { "name" => "Canada", "code" => 'CA'},;
  { "name" => "Cape Verde", "code" => 'CV'},;
  { "name" => "Cayman Islands", "code" => 'KY'},;
  { "name" => "Central African Republic", "code" => 'CF'},;
  { "name" => "Chad", "code" => 'TD'},;
  { "name" => "Chile", "code" => 'CL'},;
  { "name" => "China", "code" => 'CN'},;
  { "name" => "Christmas Island", "code" => 'CX'},;
  { "name" => "Cocos (Keeling) Islands", "code" => 'CC'},;
  { "name" => "Colombia", "code" => 'CO'},;
  { "name" => "Comoros", "code" => 'KM'},;
  { "name" => "Congo", "code" => 'CG'},;
  { "name" => "Congo, The Democratic Republic of the", "code" => 'CD'},;
  { "name" => "Cook Islands", "code" => 'CK'},;
  { "name" => "Costa Rica", "code" => 'CR'},;
  { "name" => "Cote D'Ivoire", "code" => 'CI'},;
  { "name" => "Croatia", "code" => 'HR'},;
  { "name" => "Cuba", "code" => 'CU'},;
  { "name" => "Cyprus", "code" => 'CY'},;
  { "name" => "Czech Republic", "code" => 'CZ'},;
  { "name" => "Denmark", "code" => 'DK'},;
  { "name" => "Djibouti", "code" => 'DJ'},;
  { "name" => "Dominica", "code" => 'DM'},;
  { "name" => "Dominican Republic", "code" => 'DO'},;
  { "name" => "Ecuador", "code" => 'EC'},;
  { "name" => "Egypt", "code" => 'EG'},;
  { "name" => "El Salvador", "code" => 'SV'},;
  { "name" => "Equatorial Guinea", "code" => 'GQ'},;
  { "name" => "Eritrea", "code" => 'ER'},;
  { "name" => "Estonia", "code" => 'EE'},;
  { "name" => "Ethiopia", "code" => 'ET'},;
  { "name" => "Falkland Islands (Malvinas)", "code" => 'FK'},;
  { "name" => "Faroe Islands", "code" => 'FO'},;
  { "name" => "Fiji", "code" => 'FJ'},;
  { "name" => "Finland", "code" => 'FI'},;
  { "name" => "France", "code" => 'FR'},;
  { "name" => "French Guiana", "code" => 'GF'},;
  { "name" => "French Polynesia", "code" => 'PF'},;
  { "name" => "French Southern Territories", "code" => 'TF'},;
  { "name" => "Gabon", "code" => 'GA'},;
  { "name" => "Gambia", "code" => 'GM'},;
  { "name" => "Georgia", "code" => 'GE'},;
  { "name" => "Germany", "code" => 'DE'},;
  { "name" => "Ghana", "code" => 'GH'},;
  { "name" => "Gibraltar", "code" => 'GI'},;
  { "name" => "Greece", "code" => 'GR'},;
  { "name" => "Greenland", "code" => 'GL'},;
  { "name" => "Grenada", "code" => 'GD'},;
  { "name" => "Guadeloupe", "code" => 'GP'},;
  { "name" => "Guam", "code" => 'GU'},;
  { "name" => "Guatemala", "code" => 'GT'},;
  { "name" => "Guernsey", "code" => 'GG'},;
  { "name" => "Guinea", "code" => 'GN'},;
  { "name" => "Guinea-Bissau", "code" => 'GW'},;
  { "name" => "Guyana", "code" => 'GY'},;
  { "name" => "Haiti", "code" => 'HT'},;
  { "name" => "Heard Island and Mcdonald Islands", "code" => 'HM'},;
  { "name" => "Holy See (Vatican City State)", "code" => 'VA'},;
  { "name" => "Honduras", "code" => 'HN'},;
  { "name" => "Hong Kong", "code" => 'HK'},;
  { "name" => "Hungary", "code" => 'HU'},;
  { "name" => "Iceland", "code" => 'IS'},;
  { "name" => "India", "code" => 'IN'},;
  { "name" => "Indonesia", "code" => 'ID'},;
  { "name" => "Iran, Islamic Republic Of", "code" => 'IR'},;
  { "name" => "Iraq", "code" => 'IQ'},;
  { "name" => "Ireland", "code" => 'IE'},;
  { "name" => "Isle of Man", "code" => 'IM'},;
  { "name" => "Israel", "code" => 'IL'},;
  { "name" => "Italy", "code" => 'IT'},;
  { "name" => "Jamaica", "code" => 'JM'},;
  { "name" => "Japan", "code" => 'JP'},;
  { "name" => "Jersey", "code" => 'JE'},;
  { "name" => "Jordan", "code" => 'JO'},;
  { "name" => "Kazakhstan", "code" => 'KZ'},;
  { "name" => "Kenya", "code" => 'KE'},;
  { "name" => "Kiribati", "code" => 'KI'},;
  { "name" => "Korea, Democratic People'S Republic of", "code" => 'KP'},;
  { "name" => "Korea, Republic of", "code" => 'KR'},;
  { "name" => "Kuwait", "code" => 'KW'},;
  { "name" => "Kyrgyzstan", "code" => 'KG'},;
  { "name" => "Lao People'S Democratic Republic", "code" => 'LA'},;
  { "name" => "Latvia", "code" => 'LV'},;
  { "name" => "Lebanon", "code" => 'LB'},;
  { "name" => "Lesotho", "code" => 'LS'},;
  { "name" => "Liberia", "code" => 'LR'},;
  { "name" => "Libyan Arab Jamahiriya", "code" => 'LY'},;
  { "name" => "Liechtenstein", "code" => 'LI'},;
  { "name" => "Lithuania", "code" => 'LT'},;
  { "name" => "Luxembourg", "code" => 'LU'},;
  { "name" => "Macao", "code" => 'MO'},;
  { "name" => "Macedonia, The Former Yugoslav Republic of", "code" => 'MK'},;
  { "name" => "Madagascar", "code" => 'MG'},;
  { "name" => "Malawi", "code" => 'MW'},;
  { "name" => "Malaysia", "code" => 'MY'},;
  { "name" => "Maldives", "code" => 'MV'},;
  { "name" => "Mali", "code" => 'ML'},;
  { "name" => "Malta", "code" => 'MT'},;
  { "name" => "Marshall Islands", "code" => 'MH'},;
  { "name" => "Martinique", "code" => 'MQ'},;
  { "name" => "Mauritania", "code" => 'MR'},;
  { "name" => "Mauritius", "code" => 'MU'},;
  { "name" => "Mayotte", "code" => 'YT'},;
  { "name" => "Mexico", "code" => 'MX'},;
  { "name" => "Micronesia, Federated States of", "code" => 'FM'},;
  { "name" => "Moldova, Republic of", "code" => 'MD'},;
  { "name" => "Monaco", "code" => 'MC'},;
  { "name" => "Mongolia", "code" => 'MN'},;
  { "name" => "Montserrat", "code" => 'MS'},;
  { "name" => "Morocco", "code" => 'MA'},;
  { "name" => "Mozambique", "code" => 'MZ'},;
  { "name" => "Myanmar", "code" => 'MM'},;
  { "name" => "Namibia", "code" => 'NA'},;
  { "name" => "Nauru", "code" => 'NR'},;
  { "name" => "Nepal", "code" => 'NP'},;
  { "name" => "Netherlands", "code" => 'NL'},;
  { "name" => "Netherlands Antilles", "code" => 'AN'},;
  { "name" => "New Caledonia", "code" => 'NC'},;
  { "name" => "New Zealand", "code" => 'NZ'},;
  { "name" => "Nicaragua", "code" => 'NI'},;
  { "name" => "Niger", "code" => 'NE'},;
  { "name" => "Nigeria", "code" => 'NG'},;
  { "name" => "Niue", "code" => 'NU'},;
  { "name" => "Norfolk Island", "code" => 'NF'},;
  { "name" => "Northern Mariana Islands", "code" => 'MP'},;
  { "name" => "Norway", "code" => 'NO'},;
  { "name" => "Oman", "code" => 'OM'},;
  { "name" => "Pakistan", "code" => 'PK'},;
  { "name" => "Palau", "code" => 'PW'},;
  { "name" => "Palestinian Territory, Occupied", "code" => 'PS'},;
  { "name" => "Panama", "code" => 'PA'},;
  { "name" => "Papua New Guinea", "code" => 'PG'},;
  { "name" => "Paraguay", "code" => 'PY'},;
  { "name" => "Peru", "code" => 'PE'},;
  { "name" => "Philippines", "code" => 'PH'},;
  { "name" => "Pitcairn", "code" => 'PN'},;
  { "name" => "Poland", "code" => 'PL'},;
  { "name" => "Portugal", "code" => 'PT'},;
  { "name" => "Puerto Rico", "code" => 'PR'},;
  { "name" => "Qatar", "code" => 'QA'},;
  { "name" => "Reunion", "code" => 'RE'},;
  { "name" => "Romania", "code" => 'RO'},;
  { "name" => "Russian Federation", "code" => 'RU'},;
  { "name" => "RWANDA", "code" => 'RW'},;
  { "name" => "Saint Helena", "code" => 'SH'},;
  { "name" => "Saint Kitts and Nevis", "code" => 'KN'},;
  { "name" => "Saint Lucia", "code" => 'LC'},;
  { "name" => "Saint Pierre and Miquelon", "code" => 'PM'},;
  { "name" => "Saint Vincent and the Grenadines", "code" => 'VC'},;
  { "name" => "Samoa", "code" => 'WS'},;
  { "name" => "San Marino", "code" => 'SM'},;
  { "name" => "Sao Tome and Principe", "code" => 'ST'},;
  { "name" => "Saudi Arabia", "code" => 'SA'},;
  { "name" => "Senegal", "code" => 'SN'},;
  { "name" => "Serbia and Montenegro", "code" => 'CS'},;
  { "name" => "Seychelles", "code" => 'SC'},;
  { "name" => "Sierra Leone", "code" => 'SL'},;
  { "name" => "Singapore", "code" => 'SG'},;
  { "name" => "Slovakia", "code" => 'SK'},;
  { "name" => "Slovenia", "code" => 'SI'},;
  { "name" => "Solomon Islands", "code" => 'SB'},;
  { "name" => "Somalia", "code" => 'SO'},;
  { "name" => "South Africa", "code" => 'ZA'},;
  { "name" => "South Georgia and the South Sandwich Islands", "code" => 'GS'},;
  { "name" => "Spain", "code" => 'ES'},;
  { "name" => "Sri Lanka", "code" => 'LK'},;
  { "name" => "Sudan", "code" => 'SD'},;
  { "name" => "Suriname", "code" => 'SR'},;
  { "name" => "Svalbard and Jan Mayen", "code" => 'SJ'},;
  { "name" => "Swaziland", "code" => 'SZ'},;
  { "name" => "Sweden", "code" => 'SE'},;
  { "name" => "Switzerland", "code" => 'CH'},;
  { "name" => "Syrian Arab Republic", "code" => 'SY'},;
  { "name" => "Taiwan, Province of China", "code" => 'TW'},;
  { "name" => "Tajikistan", "code" => 'TJ'},;
  { "name" => "Tanzania, United Republic of", "code" => 'TZ'},;
  { "name" => "Thailand", "code" => 'TH'},;
  { "name" => "Timor-Leste", "code" => 'TL'},;
  { "name" => "Togo", "code" => 'TG'},;
  { "name" => "Tokelau", "code" => 'TK'},;
  { "name" => "Tonga", "code" => 'TO'},;
  { "name" => "Trinidad and Tobago", "code" => 'TT'},;
  { "name" => "Tunisia", "code" => 'TN'},;
  { "name" => "Turkey", "code" => 'TR'},;
  { "name" => "Turkmenistan", "code" => 'TM'},;
  { "name" => "Turks and Caicos Islands", "code" => 'TC'},;
  { "name" => "Tuvalu", "code" => 'TV'},;
  { "name" => "Uganda", "code" => 'UG'},;
  { "name" => "Ukraine", "code" => 'UA'},;
  { "name" => "United Arab Emirates", "code" => 'AE'},;
  { "name" => "United Kingdom", "code" => 'GB'},;
  { "name" => "United States", "code" => 'US'},;
  { "name" => "United States Minor Outlying Islands", "code" => 'UM'},;
  { "name" => "Uruguay", "code" => 'UY'},;
  { "name" => "Uzbekistan", "code" => 'UZ'},;
  { "name" => "Vanuatu", "code" => 'VU'},;
  { "name" => "Venezuela", "code" => 'VE'},;
  { "name" => "Viet Nam", "code" => 'VN'},;
  { "name" => "Virgin Islands, British", "code" => 'VG'},;
  { "name" => "Virgin Islands, U.S.", "code" => 'VI'},;
  { "name" => "Wallis and Futuna", "code" => 'WF'},;
  { "name" => "Western Sahara", "code" => 'EH'},;
  { "name" => "Yemen", "code" => 'YE'},;
  { "name" => "Zambia", "code" => 'ZM'},;
  { "name" => "Zimbabwe", "code" => 'ZW'} ;
}

function main()
   local oDlg, oGet, cName, cName1, cName2
   cName := space(20)
   cName1 := space(20)
   cName2 := space(20)

   define dialog oDlg title "Test BrowseGet" size 600, 480 pixel

   @ 1,2 BROWSEGET oGet var cName of oDlg ;
         DATASOURCE aCountries;
         FILTER ListFilter1( uDataSource, cData, Self );          
         COLUMN 2 ;
         HEIGHTLIST 100
                   
   @ 2,2 BROWSEGET cName1 of oDlg ;
         DATASOURCE aCountries;
         FILTER ListFilter2( uDataSource, cData, Self );          
         COLUMN 2 ;
         HEIGHTLIST 100

   @ 3,2 BROWSEGET cName2 of oDlg ;
         DATASOURCE aCountries;
         FILTER ListFilter3( uDataSource, cData, Self );          
         COLUMN 2 ;
         HEIGHTLIST 100        


   @ 3,2 BUTTON "ok" OF odlg ACTION msgalert("Get 1:"+cName)
   @ 3,20 BUTTON "cancel" OF odlg ACTION odlg:end()

   activate dialog oDlg centered

return nil

//---------------------------------------------------------------------------//
// match case without case sensitive
function ListFilter1( aList, cData, oSelf )
   local aNewList := { }
   local uItem
   
   for each uItem in oSelf:uOrgData

      if lower( SubStr( uItem[ "name" ], 1, Len( cData ) ) ) == Lower( cData )
         AAdd( aNewList, uItem )
      endif
     
   next

RETURN aNewList

//---------------------------------------------------------------------------//
//match case with case sensitive
function ListFilter2( aList, cData, oSelf )
   local aNewList := { }
   local uItem

   for each uItem in oSelf:uOrgData

      if SubStr( uItem[ "name" ], 1, Len( cData ) ) == cData
         AAdd( aNewList, uItem )
      endif
     
   next

RETURN aNewList

//---------------------------------------------------------------------------//
//wild case
function ListFilter3( aList, cData, oSelf )
   local aNewList := { }
   local uItem
 
   for each uItem in oSelf:uOrgData

      if Lower( cData )$ lower( uItem[ "name" ] )
         AAdd( aNewList, uItem )
      endif
     
   next

RETURN aNewList
 


- Respecto al duplicado BROWSEGETCODIGOCOLUMN, correcto al montar el ejemplo en la cabecera de tbrowseget está definido dos veces, elimina una de las líneas.

Comprueba bien tu código, esta función está en producción y funciona muy, muy bien.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Thu Mar 25, 2021 6:30 pm

Si después me di cuenta que podía usar mi lista del array pero no es como el de tu ejemplo
modificare el mio para estar como tu ejemplo gracias por la aclaración :mrgreen:


Saluditos :wink:

pues como dije funciona muy bien, la lista baja bien no se esconde :D
pero algo hace que el Get sea transparente y que después de capturar
un dato y se despliegue la lista ya no permita un segundo intento :shock:
no se si sea algo en mi código :|
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby jgabri » Wed Mar 31, 2021 6:46 pm

Hola Ángel,

Enhorabuena por la clase, estoy haciendo pruebas y me da error, el ejemplo es el siguiente:


REDEFINE BROWSEGET oGetMuni[1] VAR oTabla:municipio id 29 OF oDlg DATASOURCE oVar:aMuni ;
COLUMN 1 ;
HEIGHTLIST 400

oVar:aMuni es un array unidimensional, que estoy haciendo mal ?

El error me lo da en ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )

Un saludo,

Gabriel
jgabri
 
Posts: 19
Joined: Mon Jan 14, 2019 11:43 am

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Thu Apr 01, 2021 8:34 am

Yo lo tengo a si y funciona :)

Code: Select all  Expand view  RUN
REDEFINE BROWSEGET oApp:Mentra1 var oApp:McNombre2 ID 16 of oSof PICTURE "@!";
         DATASOURCE marcas;
         FILTER ListFilter1( uDataSource, cData, Self );
         COLUMN 2 ;
         HEIGHTLIST 100  COLOR RGB(0,0,0),RGB(0,0,0)


Saluditos :wink:



jgabri wrote:Hola Ángel,

Enhorabuena por la clase, estoy haciendo pruebas y me da error, el ejemplo es el siguiente:


REDEFINE BROWSEGET oGetMuni[1] VAR oTabla:municipio id 29 OF oDlg DATASOURCE oVar:aMuni ;
COLUMN 1 ;
HEIGHTLIST 400

oVar:aMuni es un array unidimensional, que estoy haciendo mal ?

El error me lo da en ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )

Un saludo,

Gabriel
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby jgabri » Sun Apr 04, 2021 8:06 pm

Hola

Me muestra la lista, para seleccionar, pero he detectado un pequeño bug, si no seleccionas nada en lista y después te vas a otra parte del dialog, si vuelves a teclear, ya no muestra la lista desplegable.

Un saludo
Gabriel
jgabri
 
Posts: 19
Joined: Mon Jan 14, 2019 11:43 am

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Tue Apr 06, 2021 8:39 am

a si es por ahi esta un bug ya le busque y a un no doy como arreglarlo :?
después de un intento o aveces dos ya no te deja desplegar la lista al escribir :shock:

seguiré tratando de encontrar el problema :roll:

Saluditos :wink:


jgabri wrote:Hola

Me muestra la lista, para seleccionar, pero he detectado un pequeño bug, si no seleccionas nada en lista y después te vas a otra parte del dialog, si vuelves a teclear, ya no muestra la lista desplegable.

Un saludo
Gabriel
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Thu Feb 17, 2022 8:26 pm

Hola creo que nadie a podido encontrar el problema :roll:

Saluditos :wink: :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: ¿Ajuste en AUTOGET?

Postby karinha » Fri Feb 18, 2022 11:14 am

Buenos días Aída. ¿Sería posible hacer un ejemplo completo (DEMO) que muestre el problema, para probarlo?

Gracias

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ¿Ajuste en AUTOGET?

Postby AIDA » Sat Apr 23, 2022 8:43 pm

Hola karinha una disculpa me encontraba algo ocupada pero aquí están los códigos :mrgreen:

Saluditos :wink:

así lo tengo en mi programita

Code: Select all  Expand view  RUN
marcas:= {{"name" => "ACADEMY","code" =>'AC'},;
{"name" => "ACCURATE MINIATURES","code" =>'AC'},;
{"name" => "AIRES","code" =>'AI'},;
{"name" => "AIRFIX","code" =>'AI'},;
{"name" => "AMATI","code" =>'AM'},;
{"name" => "AMT","code" =>'AM'},;
{"name" => "ARII","code" =>'AR'},;
{"name" => "AZTEK","code" =>'AZ'},;
{"name" => "DRAGON","code" =>'DR'},;
{"name" => "ESCI","code" =>'ES'},;
{"name" => "FUJIMI","code" =>'FU'},;
{"name" => "GUILLOW'S","code" =>'GU'},;
{"name" => "GLENCOE","code" =>'GL'},;
{"name" => "HASEGAWA","code" =>'HA'},;
{"name" => "HELLER","code" =>'HE'},;
{"name" => "IDEA","code" =>'ID'},;
{"name" => "IMEX","code" =>'IM'},;
{"name" => "ITALERI","code" =>'IT'},;
{"name" => "JOHAN","code" =>'JO'},;
{"name" => "LINDBERG","code" =>'LI'},;
{"name" => "LODELA","code" =>'LO'},;
{"name" => "LODELA AIRFIX","code" =>'LO'},;
{"name" => "LODELA HELLER","code" =>'LO'},;
{"name" => "LODELA-LEE","code" =>'LO'},;
{"name" => "MATCHBOX","code" =>'MA'},;
{"name" => "MINICRAFT","code" =>'MI'},;
{"name" => "MONOGRAM","code" =>'MO'},;
{"name" => "MPC","code" =>'MP'},;
{"name" => "POLAR LIGHTS","code" =>'PO'},;
{"name" => "PZW","code" =>'PZ'},;
{"name" => "REVELL","code" =>'RE'},;
{"name" => "REVELL-GERMANY","code" =>'RE'},;
{"name" => "REVELL-LODELA","code" =>'RE'},;
{"name" => "REVELL-MONOGRAM","code" =>'RE'},;
{"name" => "RUSLAND","code" =>'RU'},;
{"name" => "BOBCAT","code" =>'BO'},;
{"name" => "TAMIYA","code" =>'TA'},;
{"name" => "TESTOR","code" =>'TE'},;
{"name" => "TRUMPETER","code" =>'TR'},;
{"name" => "MIDWEST","code" =>'MI'},;
{"name" => "MEGA-AIRFIX","code" =>'ME'},;
{"name" => "KP","code" =>'KP'},;
{"name" => "ICM","code" =>'IC'},;
{"name" => "AMMO","code" =>'AM'},;
{"name" => "VALLEJO","code" =>'VA'},;
{"name" => "EDUARD","code" =>'ED'},;
{"name" => "BRONCO","code" =>'BR'},;
{"name" => "GREAT WALL HOBBY","code" =>'GR'},;
{"name" => "VERLINDEN","code" =>'VE'},;
{"name" => "AK","code" =>'AK'},;
{"name" => "SQUADRON","code" =>'SQ'},;
{"name" => "LS","code" =>'LS'},;
{"name" => "TRUE DETAILS","code" =>'TR'},;
{"name" => "AMK","code" =>'AM'},;
{"name" => "SMER","code" =>'SM'},;
{"name" => "AKAH","code" =>'AK'},;
{"name" => "JESUS ZHU","code" =>'JE'},;
{"name" => "MOTOR MAX","code" =>'MA'},;
{"name" => "BINKS","code" =>'BI'},;
{"name" => "HOBBYBOSS","code" =>'HO'},;
{"name" => "TRUPER","code" =>'TR'},;
{"name" => "ENCORE_E_MODELS (SQUADRON)","code" =>'EN'},;
{"name" => "RODEN","code" =>'RO'},;
{"name" => "LODELA-KITECH","code" =>'LO'},;
{"name" => "KITECH","code" =>'KI'},;
{"name" => "DESCONOCIDA","code" =>'DE'},;
{"name" => "KINETIC","code" =>'KI'},;
{"name" => "DREAMMODEL","code" =>'DE'},;
{"name" => "MIG","code" =>'MI'},;
{"name" => "BEGEMOT","code" =>'BE'},;
{"name" => "MISTER CRAFT HOBBY KITS","code" =>'MI'},;
{"name" => "REPLI-SCALE DECALS","code" =>'RE'},;
{"name" => "IWATA","code" =>'IW'},;
{"name" => "SERGAL","code" =>'SE'},;
{"name" => "ZOUKEI-MURA","code" =>'ZO'},;
{"name" => "PAVLA MODELS","code" =>'PA'},;
{"name" => "CYBER-HOBBY","code" =>'CY'},;
{"name" => "GOLD MEDAL MODELS","code" =>'GO'},;
{"name" => "PAASCHE","code" =>'PA'},;
{"name" => "KITTY HAWK","code" =>'KI'},;
{"name" => "LICONA","code" =>'LI'},;
{"name" => "PLUS MODEL.CZ","code" =>'PL'},;
{"name" => "MODEL CHOICE","code" =>'MO'},;
{"name" => "SIN MARCA","code" =>'SI'},;
{"name" => "FREEDOM MODEL KITS","code" =>'FR'},;
{"name" => "INFINI","code" =>'IN'},;
{"name" => "KOTOBUKIYA","code" =>'KO'}}



oApp:McNombre2:= space(60)
REDEFINE BROWSEGET oApp:Mentra1 var oApp:McNombre2 ID 16 of oSof PICTURE "@!";
         DATASOURCE marcas;
         FILTER ListFilter1( uDataSource, cData, Self );
         COLUMN 2 ;
         HEIGHTLIST 100  COLOR RGB(0,0,0),RGB(0,0,0)




el browseget.ch
Code: Select all  Expand view  RUN
#ifndef _BROWSEGET_CH
#define _BROWSEGET_CH

#xcommand REDEFINE BROWSEGET [ <oGet> VAR ] <uVar> ;
             [ ID <nId> ] ;
             [ <dsrc: ARRAY, HASH, DATASOURCE> <uDataSrc> ];
             [ <fil: FILTERLIST, FILTER, LIST> <uFilter> ];            
             [ <dlg: OF, WINDOW, DIALOG> <oDlg> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ VALID   <ValidFunc> ]       ;
             [ <pict: PICT, PICTURE> <cPict> ] ;
             [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ FONT <oFont> ] ;
             [ CURSOR <oCursor> ] ;
             [ MESSAGE <cMsg> ] ;
             [ <update: UPDATE> ] ;
             [ WHEN <uWhen> ] ;
             [ ON CHANGE <uChange> ] ;
             [ <readonly: READONLY, NO MODIFY> ] ;
             [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
             [ ACTION <uAction> ] ;
             [ BITMAP <cBmpName> ] ;
             [ HEIGHTLIST <nListHeight> ] ;              
             [ CUEBANNER <cCueText> ] ;
             [ [ <fld: FIELD, COLUMN> ] <xField>] ;
             [ ITEMCOLOR <nColorTxt>[,<nColorSel>] ];              
             [ LISTWIDTH <nListWidth> ];
             [ ADAPTAGET <bAdaptaGet>];
       => ;
          [ <oGet> := ] TBrowseGet():ReDefine( <nId>, bSETGET(<uVar>), <oDlg>,;
             <nHelpId>, <cPict>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
             <oFont>, <oCursor>, <cMsg>, <.update.>, <{uWhen}>,;
             [ \{|nKey,nFlags,Self| <uChange> \}], <.readonly.>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}>, [\{|self| <uAction> \}], <cBmpName>, <"uVar">,;
             [<cCueText>], <uDataSrc>, ;
             <xField>, <nListHeight>, <nListWidth>,  <{bAdaptaGet}>,  [\{|uDataSource, cData, Self| <uFilter>\}],;
             <nColorTxt>[,<nColorSel>] )
                   
#command @ <nRow>, <nCol> BROWSEGET [ <oGet> VAR ] <uVar> ;
            [ <dsrc: ARRAY, HASH, DATASOURCE> <uDataSrc> ];
            [ <fil: FILTERLIST, FILTER, LIST> <uFilter> ];
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ <pict: PICT, PICTURE> <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ HEIGHTLIST <nListHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ CUEBANNER <cCueText> ] ;            
            [ [ <fld: FIELD, COLUMN> ] <xField>] ;
            [ ITEMCOLOR <nColorTxt>[,<nColorSel>] ];        
            [ LISTWIDTH <nListWidth> ];
            [ ADAPTAGET <bAdaptaGet>];
       => ;
          [ <oGet> := ] TBrowseGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, <.update.>, <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             .f., .f., <nHelpId>,;
             .f., , , , ,,, <"uVar">, [<cCueText>], <uDataSrc>, ;
             <xField>, <nListHeight>, <nListWidth> , <{bAdaptaGet}>,  [\{|uDataSource, cData, Self| <uFilter>\}],;
             <nColorTxt>[,<nColorSel>] )
             
#endif            
 




la clase tbrowseget.prg
Code: Select all  Expand view  RUN
/* CLASS: TBrowseGet
    Permite mostrar una lista de datos desplegable para seleccionar desde un get
*/


//TODO: Documentar

#include "fivewin.ch"
#include "browseget.ch"

#define COLOR_CAPTIONTEXT     9
#define BROWSEGETCODIGOCOLUMN   1
#define DEFAULT_GUI_FONT     17
#define DATATYPE_HASH 256


CLASS TBrowseGet FROM TGet

   DATA nItemTextColor
   DATA nItemBackgroundColor

   DATA uDataSource
   DATA uOrgData
   DATA nDataType
   DATA xField
   DATA oList
   DATA bCreateList

   DATA nListHeight
   DATA nListWidth

   DATA bAdaptaGet

   METHOD New()
   METHOD ReDefine()

   METHOD CreateList( uDataSource )
   METHOD CloseList()

   METHOD KeyChar( nKey, nFlags )
   METHOD KeyDown( nKey, nFlags )

   METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos )

   METHOD SetList( uDataSource, xField )   INLINE  ::uDataSource := uDataSource, ::xField := xField

   METHOD ValidList() INLINE ( HB_ISOBJECT (::oList) )

END CLASS

//---------------------------------------------------------------------------//

METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, bValid,;
            nClrFore, nClrBack, oFont, lDesign, oCursor, lPixel, cMsg,;
            lUpdate, bWhen, lCenter, lRight, bChanged, lReadOnly,;
            lPassword, lNoBorder, nHelpId, lSpinner,;
            bUp, bDown, bMin, bMax, bAction, cBmpName, cVarName, cCueText,;
            uDataSrc, xField    , nListHeight,  nListWidth, bAdaptaGet, bCreateList,;
            nItemTextColor, nItemBackgroundColor  ) CLASS TBrowseGet

   DEFAULT xField      := BROWSEGETCODIGOCOLUMN
   DEFAULT nListHeight := 300
   DEFAULT nListWidth  := 500

   ::xField       := xField
   ::nListHeight  := nListHeight

   ::uDataSource  := uDataSrc
   ::bCreateList  := bCreateList

   ::SetList( uDataSrc, ::xField )

   ::nItemTextColor       := nItemTextColor
   ::nItemBackgroundColor := nItemBackgroundColor

   ::nListWidth   := nListWidth
   ::bAdaptaGet   := bAdaptaGet

   ::Super:New(nRow   , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
             cPict  , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
             oCursor, lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
             lRight , bChanged, lReadOnly, lPassword, lNoBorder, nHelpId,;
             lSpinner, bUp    , bDown    , bMin     , bMax )

return ( self )

//---------------------------------------------------------------------------//

METHOD ReDefine( nId,       bSetGet,  oWnd,    nHelpId, cPict,   bValid, nClrFore,;
                 nClrBack,  oFont,    oCursor, cMsg,    lUpdate, bWhen,  bChanged,;
                 lReadOnly, lSpinner, bUp,     bDown,   bMin,    bMax,   bAction,;
                 cBmpName,  cVarName, cCueText,;
                 uDataSrc, xField    , nListHeight,  nListWidth, bAdaptaGet, bCreateList,;
                 nItemTextColor, nItemBackgroundColor ) CLASS TBrowseGet

   DEFAULT xField     := BROWSEGETCODIGOCOLUMN
   DEFAULT nListHeight := 300
   DEFAULT nListWidth := 300

   ::xField       := xField
   ::nListHeight  := nListHeight

   ::uDataSource  := uDataSrc
   ::bCreateList  := bCreateList

   ::SetList( uDataSrc, ::xField )

   ::nItemTextColor       := nItemTextColor
   ::nItemBackgroundColor := RGB(0,0,0)//nItemBackgroundColor

   ::nListWidth   := nListWidth
   ::bAdaptaGet   := bAdaptaGet

   ::Super:ReDefine( nId,       bSetGet,  oWnd,    nHelpId, cPict,   bValid, nClrFore,;
                   nClrBack,  oFont,    oCursor, cMsg,    lUpdate, bWhen,  bChanged,;
                   lReadOnly, lSpinner, bUp,     bDown,   bMin,    bMax,   bAction,;
                   cBmpName,  cVarName, cCueText )


return ( self )


METHOD CreateList() CLASS TBrowseGet

   If ! ::ValidList()

      if Len ( ::uDataSource ) > 0

        ::oList := TBrowseGetList():New( ::nListWidth, ::nListHeight, Self,;
                                         ::oFont, ::nItemTextColor, ::nItemBackgroundColor )

        ::oList:bAdaptaGet:=::bAdaptaGet
        ::oList:SetList( ::uDataSource, ::xField )

        if HB_ISOBJECT (::oList)

          ::oList:Paint()
           ::oList:Refresh()
          ::SetFocus()
        endif

        ::SetFocus()
sysrefresh()
      Endif

   Else

      ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )
      ::oList:SetList( ::uDataSource, ::xField )

      If Len ( ::oList:aData ) == 0

         ::uDataSource := ::uOrgData
         ::oList:end()
         ::oList = NIL

      Else

         ::oList:Refresh()
         ::SetFocus()

      Endif

   Endif

return ( nil )


METHOD CloseList() CLASS TBrowseGet

   if ::ValidList()

      ::oList:End()

   endif

return ( nil )


METHOD MouseWheel( nKeys, nDelta, nXPos, nYPos ) CLASS TBrowseGet

   local aPos := { nYPos, nXPos }

   if ::ValidList()

      if nDelta < 0

         ::oList:GoDown()

      else

         ::oList:GoUp()

      endif

   endif

return ( nil )


METHOD KeyDown( nKey, nFlags ) CLASS TBrowseGet

   if ::ValidList()

      switch nKey

         case VK_BACK

            ::CreateList()
            return ::Super:KeyDown( nKey, nFlags )

         case VK_LEFT

         case VK_RIGHT

            return ::Super:KeyDown( nKey, nFlags )
            exit

         case VK_DOWN

            ::oList:GoDown()
            exit

         case VK_UP

            ::oList:GoUp()

      endswitch

   else

      return ::Super:KeyDown( nKey, nFlags )

   endif

return ( 0 )

//---------------------------------------------------------------------------//

METHOD KeyChar ( nKey, nFlags ) CLASS TBrowseGet

   local nret

   switch nKey

      case VK_ESCAPE

         ::CloseList()
         return ::Super:KeyChar( nKey, nFlags )

      case VK_BACK

         nRet = ::Super:KeyChar( nKey, nFlags )

         if HB_ISOBJECT ( ::oGet )

            if Len ( Alltrim ( ::oGet:Buffer ) ) == 0

               ::CloseList()

            else

               ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )
               ::CreateList()

            endif

         endif

         return nRet

      case VK_RETURN

         if ::ValidList()

            eval ( ::oList:oBrowse:bChange )
            ::bValid := ::oList:bGetValid
            ::oList:End()
            ::oWnd:GoNextCtrl( ::hWnd )

         endif

      case VK_TAB

         if ::ValidList()

            eval ( ::oList:oBrowse:bChange )
            ::bValid := ::oList:bGetValid
            ::oList:End()
            ::oWnd:GoNextCtrl( ::hWnd )

         endif



      case VK_DOWN

         return ::Super:KeyChar( nKey, nFlags )

   endswitch

   nret = ::Super:KeyChar( nKey, nFlags )

   if ::oGet:Buffer != nil .and. Len ( Alltrim ( ::oGet:Buffer ) ) > 0

      ::uOrgData    := ::uDataSource
      ::uDataSource := Eval( ::bCreateList, ::uDataSource, AllTrim( ::oGet:Buffer ), Self )

      ::CreateList()

   endif

return ( nret )



CLASS TBrowseGetList

   DATA oDlgBrowse
   DATA oFont
   DATA oBrowse

   DATA lReleaseFont INIT .f.

   DATA nWidth
   DATA nHeight

   DATA uOrgValue
   DATA nDataType
   DATA aData

   DATA oGet
   DATA bAdaptaGet
   DATA bGetValid

   DATA bClrSel
   DATA bClrSelFocus
   DATA bClrStd


   METHOD New( nWidth, nHeight, oGet, oFont, nItemTextColor, nItemBackGroundColor )
   METHOD SetList( uDataSource, xField )
   METHOD Paint()
   METHOD Change()
   METHOD Refresh()
   METHOD GoUp()
   METHOD GoDown()
   METHOD End()

 END CLASS

 //---------------------------------------------------------------------------//
 METHOD New( nWidth, nHeight, oGet, oFont, nITemTextColor, nItemBackGroundColor ) CLASS TBrowseGetList

   ::nWidth   := nWidth
   ::nHeight  := nHeight
   ::oGet     := oGet
   ::oFont    := oFont

   DEFAULT nITemTextColor       := nRgb ("#333333")
   DEFAULT nItemBackGroundColor := nRgb (255,255,255)//("#3399fe")

   ::bClrStd       := {|| { nITemTextColor, nRgb ( '#fffffd' ) } }
   ::bClrSel       := {|| { nRgb ( '#fffffd' ), nItemBackGroundColor  } }
   ::bClrSelFocus  := {|| { nRgb ( '#fffffd' ), nItemBackGroundColor  } }

   If ::oFont == nil

     ::oFont := TFont():New()
     ::oFont:hFont := GetStockObject( DEFAULT_GUI_FONT )
     ::lReleaseFont := .t.

   Else

     ::oFont := oFont

   Endif

 return Self


 METHOD SetList( uDataSource, xField ) CLASS TBrowseGetList

   local cType := ValType( uDataSource )

   DEFAULT xField := 1

   if cType == "A"

      ::nDataType = DATATYPE_ARRAY
      ::aData := ::oGet:uDataSource

   elseif cType == "H"

      ::nDataType = DATATYPE_HASH
      ::aData := ::oGet:uDataSource

   endif

   if HB_ISOBJECT ( ::oBrowse )

      ::oBrowse:SetArray ( ::aData )

   endif

 Return ( nil )


 METHOD Paint() CLASS TBrowseGetList

   Local aPoint
   Local nColumn

   aPoint :={ ::oGet:nTop + ::oGet:nHeight, ::oGet:nLeft }
   aPoint = ClientToScreen( ::oGet:oWnd:hWnd, aPoint )

   ::bGetValid       := ::oGet:bValid
   ::oGet:bValid     := nil

   DEFINE DIALOG ::oDlgBrowse OF ::oGet:oWnd STYLE WS_POPUP ;
                 SIZE ::nWidth, ::nHeight COLOR CLR_WHITE, CLR_WHITE

   ::oDlgBrowse:nStyle := nOr (WS_POPUP, WS_BORDER)
   ACTIVATE DIALOG ::oDlgBrowse NOWAIT ;
                          ON INIT ::SetPos( aPoint[ 1 ] , aPoint[ 2 ] )


   @ 5, 5 XBROWSE ::oBrowse DATASOURCE ::aData AUTOCOLS  ;
         SIZE ::oDlgBrowse:nWidth - 10, ::oDlgBrowse:nHeight - 10  OF ::oDlgBrowse PIXEL FONT ::oFont NOBORDER

   WITH OBJECT ::oBrowse

      :nMarqueeStyle       := 5
      :lRecordSelector     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.
      :lFastDraw           := .t.
      :lHScroll            := .F.
      :lVScroll            := .F.
      :lHeader             := .f.
      :lFlatStyle          := .t.
      :nStretchCol         := STRETCHCOL_WIDEST
      :lColDividerComplete := .t.
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :nMarqueeStyle       := MARQSTYLE_HIGHLROW
      :lRefreshOnlyData    := .F.
      :lReadOnly           := .t.

      :bClrStd       := ::bClrStd
      :bClrSel       := ::bClrSel
      :bClrSelFocus  := ::bClrSelFocus

      :CreateFromCode()
      :PostMsg( WM_SETFOCUS )
      :bKeyDown   := { | nKey | If( nKey == VK_RETURN .OR. nKey == VK_TAB, ::End() , ) }
      :bLButtonUp := { | nRow, nCol | (  Eval( ::oBrowse:bChange ),;
                                               ::End(),;
                                               ::oGet:oWnd:GoNextCtrl( ::oGet:hWnd ) ) }

      :bChange   := { ||  ::Change() }

   END WITH

   WITH OBJECT ::oGet

      :oWnd:bMoved      := { || (  ::End() ) }
      :oWnd:bResized    := { || (  ::End() ) }
      :oWnd:bLClicked   := { || (  ::End() ) }

   END WITH

 Return ( nil )


 METHOD GoDown() CLASS TBrowseGetList

   ::oBrowse:GoDown()

 Return ( nil )


 METHOD GoUp() CLASS TBrowseGetList

   ::oBrowse:GoUp()

 Return ( nil )


 METHOD Change() CLASS TBrowseGetList

   ::oGet:VarPut( ::oBrowse:aCols[ ::oGet:xField ]:Value )

   if ::bAdaptaGet != NIL

      Eval ( ::bAdaptaGet )

   endif

   ::oGet:SetPos( Len ( Alltrim ( ::oGet:cText ) ) + 1 )
   ::oGet:Refresh()

 Return ( nil )


 METHOD Refresh() CLASS TBrowseGetList

   ::oBrowse:Refresh()

 return ( nil )


 METHOD End() CLASS TBrowseGetList

   if HB_ISOBJECT ( ::oBrowse )

      ::oBrowse:End()

   endif

   if HB_ISOBJECT ( ::oFont ) .and.;
     ::lReleaseFont

      ::oFont:End()
      ::oFont:=NIL

   endif

   if HB_ISOBJECT ( ::oDlgBrowse )

      ::oDlgBrowse:End()

   endif

   ::oGet:oList := nil
   ::oGet:bValid := ::bGetValid

 return ( nil )


 //-----------------------------------------//





karinha wrote:Buenos días Aída. ¿Sería posible hacer un ejemplo completo (DEMO) que muestre el problema, para probarlo?

Gracias

Regards, saludos.
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 27 guests