Page 1 of 1

Toggle a GET as readonly/not readonly

Posted: Wed Jan 03, 2007 7:31 pm
by Ollie
How can I make my program do the following:

(I understand the 'WHEN' is not available)

REDEFINE CHECKBOX oDbf:IsGift ID 4015 OF oDlg UPDATE
REDEFINE GET oDBF:GiftFrom ID 4033 OF oDlg UPDATE WHEN oDBF:ISGIFT=.T.

i.e. I want the oDBF:GiftFfrom field to be "READONLY" when oDBF:IsGift is FALSE and
oDBF:GiftFfrom field to be "MODIFY-ABLE" when oDBF:IsGift is TRUE

Posted: Wed Jan 03, 2007 8:15 pm
by James Bott
Try:

REDEFINE CHECKBOX oDbf:IsGift ID 4015 OF oDlg UPDATE;
ON CHANGE (if(oDBF:isGift, oGet:lReadonly:=.f., oGet:lReadOnly:=.t.), oGet:refresh())

REDEFINE GET oGet oDBF:GiftFrom ID 4033 OF oDlg UPDATE

Posted: Wed Jan 03, 2007 8:26 pm
by Ollie
That makes it READONLY, but is there a way I can (more visably) 'gray' it out (The way it looks when you use the NO MODIFY clause in a GET define.)

Do you know what I mean?

Posted: Wed Jan 03, 2007 8:36 pm
by James Bott
oGet:disable(), oGet:enable()

Posted: Wed Jan 03, 2007 8:47 pm
by Enrico Maria Giordano
Or

Code: Select all

REDEFINE CHECKBOX oDbf:IsGift ID 4015 OF oDlg UPDATE;
         ON CHANGE oDlg:AEvalWhen()

REDEFINE GET oDBF:GiftFrom ID 4033 OF oDlg UPDATE WHEN oDBF:ISGIFT
EMG

Posted: Wed Jan 03, 2007 8:49 pm
by Ollie
That's what I was looking for - thanks.

I notice, however, that these fields look different:

REDEFINE GET oDBF:TEST1 ID 4030 OF oFld:aDialogs[ 1 ] UPDATE NO MODIFY

(has a gray background)

REDEFINE GET oGET VAR oDBF:TEST2 ID 4030 OF oFld:aDialogs[ 1 ] UPDATE
oGET:disable()


(has a white background)

How do I match them to look the same - the latter of the two looks better I think.

Posted: Wed Jan 03, 2007 8:51 pm
by Enrico Maria Giordano

Code: Select all

REDEFINE GET oDBF:TEST1 ID 4030 OF oFld:aDialogs[ 1 ] UPDATE WHEN .F.
EMG

Posted: Wed Jan 03, 2007 9:04 pm
by Ollie
Nice!!!! Thanks.