It is probably simple, but i have a bad day i think
I have a Xbrowse with a field "NAAM". That field will be splitt into a array to have every single word (hb_aTokens)
Then there will be build btnbmp's for every word. Klikken on one of them will start a xbrowse (filter for that word)
The issues are down in the section : // THE PROBLEM CODE
The buttons label are changes only when it is a xbrowse field (or dbf) and NOT when i simply try to use arrays.
My bad but working solution is to put every word into one dbf-field and show substr's of the field.
The first 3 a build from a loop array and are not working
The second 3 a build in without loop and work.
Why are the arrays not working?
- Code: Select all Expand view RUN
function BrowseSamples()
local oDlg, oFont, oBold, oMono, oGet, oBrw, i
local nKnopTop := 100, nKnopLeft := 950, nKnopSpace := 30
Local aKnoppen:={"","","","","","",""},aKnoppentxt:={"Een","Twee","Drie","Vier","Vijf","Zes","Zeven"}
Local nTable:= 1
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-10
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD
DEFINE FONT oMono NAME "Lucida Console" SIZE 0,-10
DEFINE DIALOG oDlg SIZE 1600,800 PIXEL TRUEPIXEL FONT oFont ;
TITLE "Download online catalogus"
@ 90,20 XBROWSE oBrw SIZE 900,-20 PIXEL OF oDlg ;
DATASOURCE "webshop" ;
COLUMNS "code", "naam","Groep", "prijs","Korting","Brand", "RefLev","Link" ;
HEADERS "code", "naam","Groep", "prijs","Kor", "Brand", "RefLev","Link" ;
COLSIZES 40, 300, 100, 40, 40, 30, 30, 100 ;
AUTOSORT LINES NOBORDER
WITH OBJECT oBrw
:nMarqueeStyle := MARQSTYLE_HIGHLROWRC
:bChange := { || oDlg:Update() }
:lIncrFilter := .t.
:bSeek := { |c| ( oBrw:cAlias )->( BrwFilter( c ) ) }
:bChange := { || updateknoppen(oBrw,aKnoppentxt),oDlg:update()}
:CreateFromCode()
END
@ 20, 10 SAY TRIM( webshop->naam ) SIZE 860,30 PIXEL OF oDlg CENTER ;
FONT oBold UPDATE
@ 60, 20 SAY "Filter containing all words any where" SIZE 300,20 PIXEL OF oDlg
@ 60,240 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 250,20 PIXEL OF oDlg ;
COLOR CLR_HRED,CLR_YELLOW
@ 90,1200 SAY "CODE" SIZE 260,30 PIXEL OF oDlg CENTER ;
COLOR CLR_BLACK, nRGB( 231, 242, 255 )
@ 120,1200 GET oGet VAR webshop->memo SIZE 260,540 PIXEL OF oDlg ;
MEMO READONLY FONT oMono UPDATE
/*
for i = 1 to len(aKnoppen)
@ nKnopTop+(nKnopSpace*I),nKnopLeft BTNBMP aKnoppen[i] OF oDlg SIZE 120, 25 NOBORDER PROMPT aKnoppenTxt[i] 2007 ACTION (;
SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
next
*/
// THE PROBLEM CODE
oDlg:bInit := <||
//msglist(aKnoppentxt)
cStr = oBrw:naam:value
//msginfo(cStr)
aKnoppentxt = HB_aTokens(cStr," ")
//msglist(aKnoppentxt)
*/
for i = 1 to 3
//@ 40, 40 BTNBMP aKnoppen[ i ] ;
// PROMPT { || left(webshop->naam,10)+" : "+aKnoppentxt[i] } ;
@ nKnopTop+(nKnopSpace*I),nKnopLeft BTNBMP aKnoppen[ i ] ;
PROMPT { || left(webshop->naam,10)+" : "+aKnoppentxt[i] } ;
SIZE 240,25 PIXEL OF oDlg 2007 ACTION (SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
/*
@ nKnopTop+(nKnopSpace*I),nKnopLeft BTNBMP aKnoppen[ i ] ;
PROMPT { || substr(webshop->brand,(I*4),5) } ;
SIZE 240,25 PIXEL OF oDlg 2007 ACTION (SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
*/
next
@ nKnopTop+(nKnopSpace*5),nKnopLeft BTNBMP aKnoppen[ 4 ] ;
PROMPT { || alltrim(substr(webshop->memo,1,10)) } ;
SIZE 240,25 PIXEL OF oDlg 2007 ACTION (SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
@ nKnopTop+(nKnopSpace*6),nKnopLeft BTNBMP aKnoppen[ 5 ] ;
PROMPT { || alltrim(substr(webshop->memo,11,10)) } ;
SIZE 240,25 PIXEL OF oDlg 2007 ACTION (SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
@ nKnopTop+(nKnopSpace*7),nKnopLeft BTNBMP aKnoppen[ 6 ] ;
PROMPT { || alltrim(substr(webshop->memo,21,10)) } ;
SIZE 240,25 PIXEL OF oDlg 2007 ACTION (SET_SCOPE_Keyword(::cCaption),oDlg:update() ) font oBold CENTER UPDATE
*/
//AEval( aKnoppen, { |o| updateknoppen(oBrw) } )
//oPanel:SetRange()
return nil
>
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont, oMono, oBold
return nil
function updateknoppen(obrw,aKnoppentxt)
cStr = alltrim(oBrw:naam:value)
aKnoppen = HB_aTokens(cStr," ")
cTemp = ""
for i = 1 to len(aKnoppen)
cStr = PadR( aKnoppen[i], 10 )
cTemp = cTemp + cStr
next
webshop->memo = cTemp
return NIL