- Code: Select all Expand view RUN
- local aBtnCalc:=array(10)
local j,n:= 1
local nRow:=60
for j= 1 to 10
@ nRow,2 BTNBMP aBtnCalc[j] ;
PROMPT ltrim(str(j)) SIZE 20,20 PIXEL of oDlg FLAT NOBERDER
WITH OBJECT aBtnCalc[j]
:Cargo := {j }
:bAction := { |oBtn| oBtn:Toggle(),If( oBtn:lPressed,Givenumber(oBtn,@n,aBtnCalc),) }
:bClrGrad := { |l,oBtn| If( oBtn:lPressed, CLR_HRED, CLR_GREEN ) }
:oCursor := oHand
End
nRow+=nSpace
next j
...
in the Givenumber function (oBtn, n, aCalc) I return the numeric value(n) and change the lPressed variable on all the buttons
by assigning lPressed: =. t. only when the button is pressed
the procedure only works that sometimes it is slow as if you were thinking about it, there is probably another way to solve it
but I haven't found it
- Code: Select all Expand view RUN
- Static Function Givenumber(oBtn,n,aCalc)
For n=1 to 10
aCalc[n]:lpressed:=.f.
aCalc[n]:refresh()
next
oBtn:lpressed:=.t.
return n=oBtn:cargo[1]
any solution to speed up the selection?