IF on 3 state on doubleclick action

IF on 3 state on doubleclick action

Postby Silvio » Thu Nov 05, 2009 11:26 am

I made a simply listbox to show bitmaps
ON DBLCLICK action I insert an IF

each record fron second is 1 Character

sample : "S" or "N" or "C"


REDEFINE LISTBOX oLbx FIELDS HEADER "","1","2","3","4","5","6","7","8","9","10" ;
ID 300 OF oDlg UPDATE ;
SIZES 60, 35, 35, 35,35,35,35,35,35,35,35 ;
ON DBLCLICK ( (IF( aData[oLbx:nAt, oLbx:nColAct] = 'S', ;
aData[oLbx:nAt, oLbx:nColAct] := 'N', ;
aData[oLbx:nAt, oLbx:nColAct] := 'S'), ;
IF ( aData[oLbx:nAt, oLbx:nColAct] = 'N' ,;
aData[oLbx:nAt, oLbx:nColAct] := 'C' ,;
aData[oLbx:nAt, oLbx:nColAct] := 'N')),;
oLbx:Drawselect() )


If I use only IF( aData[oLbx:nAt, oLbx:nColAct] = 'S', ;
aData[oLbx:nAt, oLbx:nColAct] := 'N', ;
aData[oLbx:nAt, oLbx:nColAct] := 'S')


the test run ok ( with two bitmap) when I insert also the third parameter I have problems



the problem is I need 3 state "S" "N" and "C" on each state there is a different bitmap

oLbx:bLine:={|| { aData[oLbx:nAt,1],;
IF( aData[oLbx:nAt,2] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,3] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,4] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,5] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,6] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,7] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,8] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,9] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,10] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) ),;
IF( aData[oLbx:nAt,11] = 'S', oBmpYes, IF (aData[oLbx:nAt,2] = 'C',oBmpCon,oBmpNo) );
} }

I see only two bitmap

HOw I can make it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: IF on 3 state on doubleclick action

Postby James Bott » Thu Nov 05, 2009 4:17 pm

Silvio,

How about putting the bitmaps in an array and doing:

aBMP[at("CSN")]

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: IF on 3 state on doubleclick action

Postby Silvio » Fri Nov 06, 2009 10:24 am

James can you send me a sample because i try to create itr but I not Know How make it

I try to create it for two state "S" and "N" and it run ok how you can see in this picture

Image


NOw I want add a new bitmap and I not Know howe add it
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: IF on 3 state on doubleclick action

Postby Silvio » Fri Nov 06, 2009 10:33 am

PERHAPS FOUND THE SOLUTION



REDEFINE LISTBOX oLbx FIELDS HEADER "","1","2","3","4","5","6","7","8","9","10" ;
ID 300 OF oDlg UPDATE ;
SIZES 60, 35, 35, 35,35,35,35,35,35,35,35 ;
ON DBLCLICK IIF( aData[oLbx:nAt,2] = 'S', aData[oLbx:nAt, oLbx:nColAct] := 'N',;
(IF ( aData[oLbx:nAt, oLbx:nColAct] = 'N',;
aData[oLbx:nAt, oLbx:nColAct] := 'C',;
aData[oLbx:nAt, oLbx:nColAct] := 'S')) );
oLbx:Drawselect()



BUT NOT RUN OK
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: IF on 3 state on doubleclick action

Postby Silvio » Mon Nov 09, 2009 12:18 pm

any one can help me please?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: IF on 3 state on doubleclick action

Postby Patrizio » Tue Nov 10, 2009 8:37 am

Silvio, if the order of the threestate is SNC I think you can reduce your code with

Code: Select all  Expand view
aData[oLbx:nAt, oLbx:nColAct] := SubStr("SNCS",At(aData[oLbx:nAt, oLbx:nColAct],"SNCS")+1,1); oLbx:Drawselect()
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 92 guests