in the beginning the state is free (3 no pressed)
state n. 1 taken
state n. 2 fixes
state 3 free
when a user presses the first time the status is 1, if they press the second time the status is 2, if they click for the third time the status returns to 3
how can I do ?
I try to make a test but not run ok , someone can help me pls ?
- Code: Select all Expand view
#include "fivewin.ch"
#define DARKORANGE2 nRGB( 247, 192, 91 )
#define LIGHTBLUE nRGB( 89, 135, 214 )
Function test()
local nTotCol := 2
local nTotRow := 2
local oBtnNum := Array( nTotRow * nTotCol )
local oSay
local xRow:=25
local xCol:=40
local xWidth:= 40
local xHeight:= 30
local xSpace := 2
local k,t,nMaxVal:=4
DEFINE DIALOG oDlg SIZE 200,100 PIXEL TRUEPIXEL RESIZABLE
@ 10,10 SAY oSay PROMPT "0 selezionati" SIZE 100,20 PIXEL OF oDlg TRANSPARENT
For t=1 to nTotRow
For k=1 to nTotCol
nPos := nTotCol * ( t - 1 ) + k
@ xRow, xCol BTNBMP oBtnNum[ nPos ] PROMPT alltrim(str( nPos, 2)) ;
SIZE xWidth,xHeight PIXEL FLAT OF oDlg
oBtnNum[nPos]:cargo:={.f.,.f.,.f.}
oBtnNum[nPos]:bAction := BtnAction( k, t, nTotCol, nTotRow, oBtnNum, nMaxVal,oSay )
xCol += xWidth + xSpace
next
xRow += xHeight + xSpace
xCol := 40
next
ACTIVATE DIALOG oDLG
return nil
//----------------------------------------------------------------------//
Function BtnAction( x, y, nTotCol, nTotRow, aBtn, aSay, nMaxVal,oSay)
return { | oSelf | CheckStatus( oSelf, x, y, nTotCol, nTotRow, aBtn, aSay, nMaxVal,oSay ) }
//-------------------------------------------------------------------------//
Function CheckStatus( oSelf, x, y, nTotCol, nTotRow, aBtn, aSay, nMaxVal,oSay )
local nCount := 0
local j
? oSelf:lpressed
if oSelf:lpressed
oSelf:lpressed := .f.
oSelf:cargo[1]:=.t.
oSelf:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 ) } },;
{ { 1/2, RGB( 242, 244, 246 ), RGB( 145, 201, 247 ) },;
{ 1/2, RGB( 145, 201, 247 ), RGB( 242, 244, 246 ) } } ) }
else
* oSelf:lpressed := .t.
oSelf:cargo[2]:=.t.
oSelf:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 1, DARKORANGE2, DARKORANGE2 } },;
{ { 1, DARKORANGE2, DARKORANGE2 } } ) }
* oSelf:cargo[3]:=.t.
endif
oSelf:refresh()
? oSelf:lpressed
xbrowser oSelf:cargo
return nil
//------------------------------------------------------------------------------//