IF on 3 state on doubleclick action

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

IF on 3 state on doubleclick action

Post by Silvio »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: IF on 3 state on doubleclick action

Post by James Bott »

Silvio,

How about putting the bitmaps in an array and doing:

aBMP[at("CSN")]

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

Re: IF on 3 state on doubleclick action

Post by Silvio »

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

Post by Silvio »

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

Post by Silvio »

any one can help me please?
Best Regards, Saludos

Falconi Silvio
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: IF on 3 state on doubleclick action

Post by Patrizio »

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

Code: Select all

aData[oLbx:nAt, oLbx:nColAct] := SubStr("SNCS",At(aData[oLbx:nAt, oLbx:nColAct],"SNCS")+1,1); oLbx:Drawselect()
Post Reply