change on line a combo

Re: change on line a combo

Postby Silvio.Falconi » Tue Nov 17, 2020 4:45 pm

karinha wrote:Congratulations Silvio, excellent example. I modified it a little for my taste. Some things, I didn't understand, so I can't help much. Very good.

.


same error
Code: Select all  Expand view
Application
===========
   Path and name: C:\Work\Errori\dbsearch_kapiaba\test.Exe (32 bits)
   Size: 4,069,376 bytes
   Compiler version: Harbour 3.2.0dev (r1904111533)
   FiveWin  version: FWH 20.06
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.1, Build 7600

   Time from start: 0 hours 0 mins 36 secs
   Error occurred at: 17-11-2020, 17:35:36
   Error description: Error BASE/1132  Limiti superati: accesso all'array
   Args:
     [   1] = A   { ... } length: 5
     [   2] = N   0

Stack Calls
===========
   Called from: test.prg => (b)TABLEDB( 234 )
   Called from: .\source\classes\TGET.PRG => TGET:KEYDOWN( 1782 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1827 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1221 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: test.prg => TABLEDB( 321 )
   Called from: test.prg => MAIN( 62 )




to see the error

select in the combox "City" search for the city "atlanta" by inserting only the one letter "a"...go in error
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Silvio.Falconi » Tue Nov 17, 2020 5:49 pm

Otto wrote:Silvio,
can you please try this:

Function ChangeBrowse( oBrw, oControl)
local aItems:= {}

AEval( oBrw:aCols, { |o| If( o:lHide,, iif( len(alltrim(o:cHeader))>0, AAdd( aItems, o:cHeader ) , ) ) } )
oControl[2]:setItems(aItems)
oControl[2]:refresh()

oBrw:Setfocus()
return nil
//-----------------------------------------------------------------------------------------------------//


Best regards,
Otto


Dear Otto,
your modification is good in fact it made me no error

but there would be another problem

can you try these steps ?

1) you search for a city, for example "atlanta" by selecting "city" in the combobox. already at the third letter "atl" shows you the right records, ok

2) Now go to the small menu ( to right) and select "colonne" and hide two columns city and street

3) now select on combobox "state" and digit "ner"
the procedure is not looking for "ner" in the state field but is looking for "ner" in the "street" field which is hidden
in fact if you restore the street column you will see that the procedure has searched for the "energy" address
so, even if you hide the columns the procedure is not looking for the data in the field that you have selected but in the field number that is related to the combobox nfield
in reality the procedure should search in the selected field, if I select "state" he must look for the data in the "state" field and not in another field where he wants
how can i solve?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Otto » Tue Nov 17, 2020 7:51 pm

Hello Silvio,
can you please try these changes:



nField :=1
//header

AAdd( aHdrs, "" )
AAdd( aColumns, "" )

for n= 1 to Len(aBrowse)
AAdd( aHdrs, aBrowse[n][2] )
AAdd( aColumns, aBrowse[n][1] )
next

And change back AEval( oBrw:aCols, { |o| If( o:lHide,, iif( len(alltrim(o:cHeader))>0, AAdd( aItems, o:cHeader ) , ) ) } )
to AEval( oBrw:aCols, { |o| If( o:lHide,,AAdd( aItems, o:cHeader ) ) } )

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: change on line a combo

Postby Silvio.Falconi » Wed Nov 18, 2020 8:41 am

Otto wrote:Hello Silvio,
can you please try these changes:



nField :=1
//header

AAdd( aHdrs, "" )
AAdd( aColumns, "" )

for n= 1 to Len(aBrowse)
AAdd( aHdrs, aBrowse[n][2] )
AAdd( aColumns, aBrowse[n][1] )
next

And change back AEval( oBrw:aCols, { |o| If( o:lHide,, iif( len(alltrim(o:cHeader))>0, AAdd( aItems, o:cHeader ) , ) ) } )
to AEval( oBrw:aCols, { |o| If( o:lHide,,AAdd( aItems, o:cHeader ) ) } )

Best regards,
Otto


Otto, make error

Code: Select all  Expand view
Application
===========
   Path and name: C:\Work\Errori\dbSearch\dbsearch.Exe (32 bits)
   Size: 4,161,536 bytes
   Compiler version: Harbour 3.2.0dev (r1712141320)
   FiveWin  version: FWH 20.04
   C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 36 secs
   Error occurred at: 18-11-2020, 09:40:11
   Error description: Error BASE/1102  Parametro errato: UPPER

Stack Calls
===========
   Called from:  => UPPER( 0 )
   Called from: dbsearch.prg => INCRFILTER( 486 )
   Called from: dbsearch.prg => KEYCHAR( 444 )
   Called from: dbsearch.prg => (b)TABLEDB( 238 )
   Called from: .\source\classes\TGET.PRG => TGET:KEYDOWN( 1782 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1827 )
   Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1221 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: dbsearch.prg => TABLEDB( 326 )
   Called from: dbsearch.prg => MAIN( 66 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Otto » Thu Nov 19, 2020 2:54 am

Silvio,

please undo

Hello Silvio,
can you please try these changes:



nField :=1
//header

AAdd( aHdrs, "" )
AAdd( aColumns, "" )

for n= 1 to Len(aBrowse)
AAdd( aHdrs, aBrowse[n][2] )
AAdd( aColumns, aBrowse[n][1] )
next

And change back AEval( oBrw:aCols, { |o| If( o:lHide,, iif( len(alltrim(o:cHeader))>0, AAdd( aItems, o:cHeader ) , ) ) } )
to AEval( oBrw:aCols, { |o| If( o:lHide,,AAdd( aItems, o:cHeader ) ) } )

Best regards,
Otto


Then please try this code:
Code: Select all  Expand view

//aGet[1]:bKeyDown := { | nKey | KeyChar( oBrw, nKey,nField,cDbf, acolumns[nField], aGet[1]) }

aGet[1]:bKeyDown := { | nKey |   KeyChar( oBrw, nKey,nField,cDbf, aGet[2]:cTitle, aGet[1]) }

oBrw:CreateFromCode()




Code: Select all  Expand view

  MENUITEM "Colonne" ACTION ( SelectColumns( oBrw )  ,;
         ChangeBrowse(oBrw,aGet), aGet[1]:SetFocus() )

@ 40,  195 COMBOBOX aGet[2] var nField ITEMS aHdrs  SIZE  130, 90  PIXEL;
   OF oTabella HEIGHTGET 20  UPDATE ON CHANGE aGet[1]:SetFocus()
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: change on line a combo

Postby Silvio.Falconi » Thu Nov 19, 2020 8:43 am

Otto wrote:Silvio,

please undo


Can you publish all the source please because here not run
sample you must digit "atlanta"

I digit on get "a" and then then oBrw refresh
then I digit "t" and the brw not refresh

it seems to have the cseek allways = "a"

because when you digit "a" it not save "a" to oBrw:cseek but only a space " "
then when you digit "t" save on obrw:cseek only "a" and not "at"
then when you digit "l" save on obrw:seek "at" and not "atl"

look

Image


Image


Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Silvio.Falconi » Thu Nov 19, 2020 9:16 am

ok Now seem run ok

Code: Select all  Expand view
   #include "fivewin.ch"
    #include "constant.ch"
    #include "ttitle.ch"

    REQUEST DBFCDX

    static cSeek   := ''
    static oSeek
    static nField


    static  cIniFile

    REQUEST HB_Lang_IT
    REQUEST HB_CODEPAGE_ITWIN


    REQUEST DBFCDX
    REQUEST DBFFPT
    EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO


    FUNCTION Main()


       local cDbf     := "Cust"
       local aBrowse


        HB_LangSelect("IT")
        HB_SetCodePage("ITWIN")

        SET _3DLOOK ON
        SET CENTURY ON
        SET DATE ITALIAN

        RDDSetDefault( 'DBFCDX' )

       cIniFile    := cFilePath( GetModuleFileName( GetInstance() ) ) + "tabledb.ini"


        USE CUSTOMER  ALIAS CUST
       INDEX ON FIRST  TAG FIRST    TO TMFIRST  MEMORY
       INDEX ON LAST   TAG LAST     TO TMPLAST  MEMORY
       INDEX ON CITY   TAG CITY     TO TMPCITY  MEMORY
       INDEX ON STATE  TAG STATE    TO TMPSTATE MEMORY


        cust->(dbsetorder(1))
        cust->(dbgotop())




         // { field, header, picture, size, justify, sortorder }

        aBrowse   := { { "CUST->FIRST",  "First",,               120, },;
                       { "CUST->LAST",   "Last",,                120, },;
                       { "CUST->STREET", "Street",,              180, },;
                       { "CUST->CITY",   "City",,                150, },;
                       { "CUST->STATE",  "State",,               50, }}


            bedit:= { || MsgInfo( "modify" ) }

       TableDb(aBrowse,cDbf,"Customers table","Cust",bedit)

       RETURN NIL

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

    Function TableDb(aBrowse,cDbf,cTitle,cPrefix,bedit)

       local oTabella
       local oBrw,oSay1,oSay2
       local oFont,oFontSmall,oBold
       local  oCursorBtn :=TCursor():New(,'HAND')

       local  nBottom   := 28
       local  nRight    := 99.9
       local  nWidth    :=  Max( nRight * DLG_CHARPIX_W, 180 )
       local  nHeight   := nBottom * DLG_CHARPIX_H

       local  aBtnBrow  := array(4)
       local  aBtnNav   := array(4)

       local  cSearch:=space(20)
       local aGet[2]
       local cField:=""
       local aHdrs := {}  //Headers
       local aColumns := {}
       local n


        // da personalizzare

       local cImage:= "C:\Work\fwh\bitmaps\contact.bmp"
       local cTitle1:= "Customers"
       local cTitle2:= "Insert the customer to search"
      // local bNew,bEdit,bDel,bSearch,bPrint,bOk,bExit


        local cSelected   := ";"

       if File( "CUSTSEL.TXT" )
          cSelected   := MEMOREAD( "CUSTSEL.TXT" )
       endif

       if Empty( cSelected )
          cSelected   := ";"
       endif


       nField  :=1
       //header

       AAdd( aHdrs, "" )
       AAdd( aColumns, "" )

           for n= 1 to Len(aBrowse)
              AAdd( aHdrs, aBrowse[n][2] )
              AAdd( aColumns, aBrowse[n][1] )
           next



         DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
         DEFINE FONT oFontSmall NAME 'Tahoma' SIZE 0, -14
         DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD



          DEFINE DIALOG oTabella  TITLE cTitle   ;
          SIZE nWidth, nHeight  FONT  oFont ;
          PIXEL TRUEPIXEL RESIZABLE COLOR CLR_BLACK,  nRgb( 245,244,234)



      @ 0,0 TITLE  oTitle OF oTabella size oTabella:nwidth, 60 BORDER SHADOW NOSHADOW   ;
                           GRADIENT { { 1, CLR_WHITE, CLR_WHITE } }
      @ 10, 12 TITLETEXT OF oTitle TEXT cTitle1 FONT oBold COLOR CLR_GRAY
      @ 28, 12 TITLETEXT OF oTitle TEXT cTitle2 FONT oFont COLOR CLR_HGRAY
      @ 10, 12  TITLEIMG oImg  OF oTitle  BITMAP cImage  SIZE 50,50 TRANSPARENT

      @ 66,3 SAY oSay1 Prompt "Search " ;
                FONT oBold SIZE 120,20 PIXEL OF oTabella  TRANSPARENT
      @ 42,  181 Say oSay2 Prompt  "in"  ;
               FONT oBold SIZE  55,   20 PIXEL   OF oTabella  TRANSPARENT


           DEFINE BUTTONBAR oBar OF oTabella SIZE 70,70  BOTTOM NOBORDER  2010
           DEFINE BUTTON OF oBar PROMPT "New"          ACTION If( oBrw:bEdit == nil, oBrw:Edit( .t. ), oBrw:EditSource( .t. ) )
           DEFINE BUTTON OF oBar PROMPT "Modify"   GROUP  ACTION If( oBrw:bEdit == nil, oBrw:Edit(), oBrw:EditSource() )
           DEFINE BUTTON OF oBar PROMPT "Delete"    ACTION ( If( MsgNoYes( "Delete Record?" ), oBrw:Delete(), nil ), oBrw:SetFocus() )
           DEFINE BUTTON OF oBar PROMPT "Print"       ACTION  If( Empty( oBrw:bPrint ), oBrw:Report(), oBrw:Print() )
           DEFINE BUTTON OF oBar PROMPT "Exit"         GROUP ACTION oTabella:End()


          oBar:bClrGrad := { | lPressed | If( ! lPressed,;
                           { { 1,  nRgb(233,229,206),nRgb(233,229,206) } },;
                           { {  1, nRgb( 245,244,234), nRgb( 245,244,234) } } ) }




            @ 100,5 XBROWSE oBrw  ;
               SIZE 385,130 PIXEL;
               OF oTabella ;
               ALIAS cDbf COLUMNS aBrowse NOBORDER  FOOTERS


        FOR i := 1 TO LEN(oBrw:aCols)
          oCol := oBrw:aCols[ i ]
          oCol:bClrSelFocus  := { || { CLR_BLACK, nRGB(202,224,252) } }
        NEXT


       WITH OBJECT oBrw
          WITH OBJECT oBrw:InsCol(1)
            :nwidth:= 30
            :bEditValue    := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
            :SetCheck( nil, .t.)
            :nHeadBmpNo    := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
            :bFooter       := { || ltrim(Str( Len(oBrw:aSelected))) }
            :bLClickHeader := { || oBrw:SelectRow( If( Len( oBrw:aSelected ) == oBrw:nLen, 0, 4 ) ), oBrw:Refresh() }

         End

          :bLClicked := { |r,c,f,oBrw| If( oBrw:MouseColPos( c ) == 1 , ;
                       If( ( f := AScan( oBrw:aSelected, oBrw:BookMark ) ) == 0, ;
                         AAdd( oBrw:aSelected, oBrw:BookMark ), ;
                         ADel( oBrw:aSelected, f, .t. ) ), Nil ), ;
                         oBrw:RefreshCurrent() }




          WITH OBJECT oBrw:aCols[ 2 ]
             :bFooter   := { || Ltrim( Str( oBrw:KeyNo() ) ) + " / " + LTrim( Str( oBrw:KeyCount() ) )+" customers" }
          END




          :bChange  := { |o| o:RefreshFooters() }
          :bKeyChar   := { |k| If( k == VK_SPACE, ( oBrw:oCol( 1 ):CheckToggle(), oBrw:RefreshCurrent(), 0 ), nil ) }
          :bLDblClick := { || oBrw:oCol( 1 ):CheckToggle(), oBrw:RefreshCurrent() }
          :bClrStd    := { || { CLR_BLACK, If( oBrw:oCol( 1 ):Value, 0x80ffff, CLR_WHITE ) } }
          //


       :l2007:=.f.
       :lColDividerComplete := .t.
       :lRecordSelector     := .t.
       :lHScroll            := .f.
       :nHeaderHeight       := 30
       :nRowHeight          := 30
       :nFooterHeight       := 30
       :nStretchCol         := -1
       :lDrawBorder := .t.
      *  :lIncrFilter   := .t.
      *  :lSeekWild     := .f.
       :lAllowColHiding := .f.

      :nRecSelColor     :=   nRgb( 245,244,234)
      :bClrHeader       := {|| { ,nRgb(233,229,206) } }
      :bClrFooter       := {|| { ,nRgb( 245,244,234) } }
      :nColDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
     END



         @ 40,  45  GET aGet[1] VAR cSearch  SIZE  250,  25  PIXEL OF oTabella ON CHANGE  (oBrw:cSeek:=AllTrim( cSearch )   )    UPDATE

          @ 40,  195 COMBOBOX aGet[2] var nField ITEMS aHdrs  SIZE  130, 90  PIXEL;
           OF oTabella HEIGHTGET 20  UPDATE ON CHANGE aGet[1]:SetFocus()
         // aGet[1]:bKeyDown := { | nKey | KeyChar( oBrw, nKey,nField,cDbf,acolumns[nField],aGet[1]) }
          aGet[1]:bKeyDown := { | nKey |   KeyChar( oBrw, nKey,nField,cDbf, aGet[2]:cTitle, aGet[1]) }

        oBrw:CreateFromCode()




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

          @ 40, oBrw:nWidth-20  BTNBMP aBtnBrow[1]   ;
                    FLAT SIZE 30, 30  OF oTabella   PIXEL ;
                    COLOR  nRgb(203, 225, 252),nRgb(238,236,219) ;
                    BITMAP ".\bitmaps\rinfresca.bmp" NOROUND;
                    tooltip "Clear the search" ;
                    ACTION ( (cDbf)->( DbClearFilter() )        ,;
                             (cDbf)->( Dbgotop() )              ,;
                             oBrw:refresh()                   ,;
                             cSearch:=space(60)               ,;
                             aGet[1]:SetText( cSearch )       ,;
                             aGet[1]:refresh()                ,;
                             cSeek   := ''                    ,;
                             oBrw:cSeek:=AllTrim( cSearch )   ,;
                             aGet[1]:setfocus()        )



         @ oBrw:nBottom+2, oBrw:nWidth-50 BTNBMP aBtnBrow[2]   ;
                    FLAT  SIZE 30, 30  OF oTabella   PIXEL ;
                    COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
                    BITMAP ".\bitmaps\su.bmp" NOROUND;
                    ACTION oBrw:KeyDown(VK_UP, 0)

       @ oBrw:nBottom+2, oBrw:nWidth-35 BTNBMP aBtnBrow[3] ;
                    FLAT  SIZE 30, 30  OF oTabella   PIXEL ;
                    COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
                    BITMAP ".\bitmaps\giu.bmp" NOROUND;
                    ACTION oBrw:KeyDown(VK_DOWN, 0)

       @ oBrw:nBottom+2, oBrw:nWidth-20 BTNBMP aBtnBrow[4] ;
                    FLAT  SIZE 30, 30  OF oTabella   PIXEL ;
                    COLOR  nRgb(238,236,219),nRgb(238,236,219) ;
                    BITMAP ".\bitmaps\impostazioni.bmp" NOROUND;
                    ACTION ::ShowPopUp( { |oBtn| MenuContextual(oBtn,oBrw,cPrefix+"Aux",cDbf,aGet)  } )


          For n= 1 to 4
                  aBtnBrow[n]:bClrGrad = { | lInvert | If( ! lInvert,;
                        { { 1, RGB( 225, 225, 225 ), RGB( 225, 225, 225 ) } },;
                        { { 1, RGB( 229,241,251 ), RGB( 229,241,251 ) } } ) }
                 aBtnBrow[n]:nClrBorder := nRgb(218,214,179)
                 aBtnBrow[n]:oCursor:=   oCursorBtn
              next


          oTabella:bResized  := <||
               local oRect       := oTabella:GetCliRect()
               oTitle:nWidth     := oRect:nRight
               oBrw:nWidth       := oRect:nRight-10
               oBrw:nHeight      := oRect:nbottom-210
               oImg:aImgs[2]     := oRect:nRight-60
               aGet[1]:nTop      := oTitle:nBottom+5
               aGet[1]:nLeft     := oRect:nLeft+90
               oSay1:nTop        := oTitle:nBottom+7
               oSay1:nLeft       := oRect:nLeft+10
               oSay2:nTop        := oTitle:nBottom+7
               oSay2:nLeft       := oRect:nLeft+360
               aGet[2]:nTop      := oTitle:nBottom+5
               aGet[2]:nLeft     := oRect:nLeft+380
               aBtnBrow[1]:nTop  := oTitle:nBottom+5
               aBtnBrow[1]:nLeft := oRect:nRight-37
               aBtnBrow[2]:nTop  := oBrw:nBottom+5
               aBtnBrow[2]:nLeft := oRect:nRight-112
               aBtnBrow[3]:nTop  := oBrw:nBottom+5
               aBtnBrow[3]:nLeft := oRect:nRight-75
               aBtnBrow[4]:nTop  := oBrw:nBottom+5
               aBtnBrow[4]:nLeft :=oRect:nRight-37



               return nil
                 >

            oTabella:aMinMaxInfo := { nil, nil, nil, nil, 650,350, nil, nil }


    oBrw:bSeek  := nil
    ACTIVATE DIALOG oTabella CENTER  ;
    ON INIT  (otabella:resize(),EVAL( oTabella:bResized)  )



     return nil



    //-----------------------------------------------------------------------------------------------------//
    Function ChangeBrowse(oBrw,oControl)
        local aItems:= {}
        AEval( oBrw:aCols, { |o| If( o:lHide,,AAdd( aItems, o:cHeader ) ) } )
        oControl[2]:setItems(aItems)
        oControl[2]:refresh()
    return nil
    //-----------------------------------------------------------------------------------------------------//
     function SelectColumns( oBrowse )

       local oDlg, oBrw,oFont,oBold
       local aSave    := aCopy( oBrowse:aCols )
       Local cSaveState:= oBrowse:SaveState()

           DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
           DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD

           DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL ;
           TITLE "Position  Columns";
           COLOR CLR_BLACK,nRgb(245,244,234)

           DEFINE BUTTONBAR oBar OF oDlg SIZE 64,70 2010 BOTTOM NOBORDER
           DEFINE BUTTON OF oBar PROMPT "Exit"     FILE "NO_DLG";
                                    ACTION ( oDlg:end( IDCANCEL ) )

           DEFINE BUTTON OF oBar PROMPT "ok"  FILE "OK_DLG";
           ACTION ( oDlg:end( IDOK ) )   BTNRIGHT

          oBar:bClrGrad := { | lPressed | If( ! lPressed,;
                           { { 1, nRgb(233,229,206),nRgb(233,229,206) } },;
                           { { 1, nRgb( 245,244,234), nRgb( 245,244,234) } } ) }



           @ 10,20 XBROWSE oBrw SIZE -10,-90 PIXEL OF oDlg ;
          DATASOURCE oBrowse:aCols ;
          COLUMNS "cHeader", "lHide";
          HEADERS "Columns","" ;
          COLSIZES 100, 40 ;
           NOBORDER FONT oFont

       WITH OBJECT oBrw
               :l2007:=.f.
              :nStretchCol   := STRETCHCOL_WIDEST
              :lDrawBorder := .t.
              :bClrHeader       := {|| { ,nRgb(233,229,206) } }
              :bClrFooter       := {|| { ,nRgb( 245,244,234) } }
              :nColDividerStyle := LINESTYLE_LIGHTGRAY
              :lRecordSelector     := .f.
              :lHScroll            := .f.

          WITH OBJECT :aCols[ 2 ]
             :bEditValue    := { |x| If( x == nil, !oBrw:aRow:lHide, oBrw:aRow:lHide := !x ) }
             :SetCheck( nil, .t. )
             :nHeadBmpNo    := 2
          END
          :CreateFromCode()
       END

       ACTIVATE DIALOG oDlg CENTERED;
         ON INIT (oDlg:resize())
           RELEASE oFont,oBold

           IF oDlg:nresult == IDOK
               oBrowse:refresh()
            ENDIF

    return nil













     #define EM_GETSEL          176

    static function KeyChar( oBrw, nKey,n,cdbf,cField,oControl,oSayCounter)
       local nPos, cText

       *If nKey == VK_BACK .and. ! Empty( cSeek )
          If nKey == VK_BACK .and. cSeek != nil .and. Len( cSeek ) > 0
            ( oBrw:cAlias )->( IncrFilter( oBrw, Left( cSeek, Len( cSeek ) -1 ),n,cdbf,cField,oControl) )


          nPos     = nLoWord( oControl:SendMsg( EM_GETSEL ) ) + 1
          if nPos < 1
             return 0
          endif
          cText    = oControl:GetText()
          cText    := HB_UTF8LEFT( cText, nPos - 2 ) + HB_UTF8SUBSTR( cText, nPos )
          oControl:SetText( cText )
          oControl:oGet:buffer = oControl:GetText()
          oControl:oGet:pos := oControl:nPos := --nPos
          oControl:SetPos( nPos )


           oControl:setfocus() //get

           return 0

      * elseIf nKey > 31
       elseIf nKey > 31   .and. nKey != Asc( '*' ) .and. nKey != Asc( '?' )

          ( oBrw:cAlias )->( IncrFilter( oBrw, cSeek + Chr( nKey ),n,cdbf,cField,oControl) )



         oControl:setfocus()  //get

          return 0
       Endif


    return nil

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

    static function IncrFilter( oBrw,cPattern,n,cdbf,cField,oControl,oSayCounter)

       local cFilter:="", lFound := .f.
       local nRecNo, cSaveFilt, lStay
       local cField_name :=alltrim(cField)


             (cdbf)->(OrdSetFocus(n))

       if ValType( cPattern ) == 'C'
          if Empty( cPattern )
             cSeek       := ""
            //
            *  oSeek:SetText( cSeek )
            * oSeek:cText( cSeek )
            * oSeek:REFRESH()


           //
             SET FILTER TO !DELETED()
             GO TOP
             oBrw:Refresh()
             lFound      := .t.

          else
             cFilter     := 'WildMatch( "*' + Upper(cPattern) + '*",    Upper( '+cField_name+'))  .AND. !DELETED()'
             cSaveFilt   := DBFILTER()
             nRecNo      := RECNO()
             lStay       := &cFilter
             SET FILTER TO &cFilter
             GO TOP
             if OrdKeyCount() == 0
                SET FILTER TO &cSaveFilt
                GO TOP
                DBGOTO( nRecNo )

             else
                 (cdbf)->(OrdSetFocus(n))

                cSeek    := cPattern
               //
               * oSeek:cText( cSeek )
               * oSeek:REFRESH()

              //
                if lStay
                   DBGOTO( nRecNo )
                   oBrw:Refresh()
                else
                   oBrw:Refresh( .t. )
                endif
                lFound   := .t.
             endif
          endif
       endif



    return lFound
    //-------------------------------------------------------------------------------------------//


        Function MenuContextual(oControl,oBrw,cIniEntry,cDbf,aGet)
               local oMenu

            MENU oMenu POPUP
            MENUITEM "Seleziona la linea corrente" ;
            ACTION  NIL
               MENUITEM "Seleziona tutto"
               MENUITEM "Esporta" Action NIL
              MENUITEM "Colonne" ACTION ( SelectColumns( oBrw )  ,;
         ChangeBrowse(oBrw,aGet), aGet[1]:SetFocus() )



             ENDMENU

             return oMenu


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



 


BUT...
all fields are character
idf there is Date or Loginc or Number fields not run
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Otto » Fri Nov 20, 2020 10:53 am

Hello Silvio,
a video with you!
Best regards,
Otto

https://mybergland.com/fwforum/xbrowse.mp4
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: change on line a combo

Postby Silvio.Falconi » Wed Nov 25, 2020 12:46 pm

Nages can help me to make the search on my dialog pls
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: change on line a combo

Postby Silvio.Falconi » Wed Nov 25, 2020 12:47 pm

Otto wrote:Hello Silvio,
a video with you!
Best regards,
Otto

https://mybergland.com/fwforum/xbrowse.mp4


Otto I need the search on windows thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests