Toggle a GET as readonly/not readonly

Post Reply
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Toggle a GET as readonly/not readonly

Post 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
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post 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?
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

oGet:disable(), oGet:enable()
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post 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.
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Code: Select all

REDEFINE GET oDBF:TEST1 ID 4030 OF oFld:aDialogs[ 1 ] UPDATE WHEN .F.
EMG
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

Nice!!!! Thanks.
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Post Reply