Page 1 of 1

XBROWSE and any Key

Posted: Sun Jul 31, 2022 8:54 am
by Jimmy
hi,

i do have

Code: Select all | Expand

     @ 000, 400 XBROWSE oBrw SIZE 400, 540 PIXEL OF oDlg ON DBLCLICK DoShow( TVURL->TVURL ) FONT oFont ALIAS 'TVURL'

      ADD oCol TO oBrw DATA TVURL->TVCHNO HEADER "Channel"
      ADD oCol TO oBrw DATA TVURL->TVNAME HEADER "Name"

      oBrw:nMoveType := 5  // does stay in ROW ... but move to COL right
      oBrw:bKeyDown := { | nKey | IF( nKey == VK_RETURN, DoShow( TVURL->TVURL ), nil) }
      oBrw:bLDblClick = { || DoShow( TVURL->TVURL ) }  // dupe ?
      oBrw:bchange := { || Do_Store() }

      oBrw:CreateFromCode()

i can navigate with Cursor or Mouse and use ENTER or Dblckick.

but when type any a-z 1-0 Position in XBROWSE it "move" ... Position not "match" Index ...
so what is wrong with my Code :?:

need help please

Re: XBROWSE and any Key

Posted: Sun Jul 31, 2022 1:45 pm
by nageswaragunupudi
Please add

Code: Select all | Expand

oBrw:bSeek := nil

Re: XBROWSE and any Key

Posted: Sun Jul 31, 2022 3:13 pm
by Jimmy
hi,
nageswaragunupudi wrote:

Code: Select all | Expand

oBrw:bSeek := nil

thx for Answer,

that Trick lead me to the Question : is there a \Sample to use Codeblock bSeek :?:

Code: Select all | Expand

       bSeek,;      // block expresion for autoincremental search. It should return .T. when found
        ;            // Receives the string to search

Re: XBROWSE and any Key

Posted: Sun Jul 31, 2022 4:33 pm
by nageswaragunupudi
bSeek is automatically generated by XBrowse internally, depending on the type of database (i.e., array,dbf,tdbf,ado, etc.)
Better not to attempt preparing our own bSeek.

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 5:27 am
by Jimmy
hi,

have found c:\fwh\samples\testxbrw.prg

Code: Select all | Expand

oBrw:bSeek            := {|c| DbSeek( Upper( c ) ) }

seems easy to use ...

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 8:19 am
by nageswaragunupudi
Jimmy wrote:hi,

have found c:\fwh\samples\testxbrw.prg

Code: Select all | Expand

oBrw:bSeek            := {|c| DbSeek( Upper( c ) ) }

seems easy to use ...

Better you see the bSeek construction inside xbrowse.prg

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 5:36 pm
by Jimmy
hi,
nageswaragunupudi wrote:Better you see the bSeek construction inside xbrowse.prg

Yes, you are right, it is all in Source Code

but i must "see" how it work to understand what Code "mean"
so, as FiveWin Newbie, i ask for working Sample

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 6:58 pm
by nageswaragunupudi

Code: Select all | Expand


#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   FWNumFormat( "E", .T. ) // European number format

   FERASE( "CUSTOMER.CDX"
   USE CUSTOMER NEW VIA "DBFCDX"
   FW_CdxCreate()

   XBROWSER "CUSTOMER" AUTOSORT

 


Please build and run this code in the samples folder.

This will demonstrate default Incremental Seek, SeekWild, Incremental Filter, Incremental Filter Wild
First play with it and then see the default XBrowse code.

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 7:06 pm
by nageswaragunupudi
Some notes that may help you.

Please treat the syntax:

Code: Select all | Expand

ADD TO oBrw
for creating columns as obsolete. This command was created many years back for compatibility with TCBrowse for easier migration from TCBrowse to TXBrowse.

Same way, please do not use the FIELDS clause for similar reasons.

Instead use COLUMNS syntax.

Better avoid them to take full advantage of all features of XBrowse,

Re: XBROWSE and any Key

Posted: Mon Aug 01, 2022 7:25 pm
by Jimmy
hi,
nageswaragunupudi wrote:This will demonstrate default Incremental Seek, SeekWild, Incremental Filter, Incremental Filter Wild
First play with it and then see the default XBrowse code.

thx for Sample.
i will try it and "see" how it work

Question : will it work when have

Code: Select all | Expand

SETKEY( ASC( "F" ), { || SwitchFull() } )

it seems me when type "f" it will always use SETKEY() ( not limited to WINDOW )