How and where to set the checked state of a toggle box before the screen is displayed?
Thanks,
Ab
Set the value of the variable to YES before displaying it. If this doesn't help, please provide a short example showing what you're trying to do so we can see where the problem might be.
DEFINE VARIABLE a AS LOGICAL VIEW-AS TOGGLE-BOX NO-UNDO. DEFINE FRAME f a WITH THREE-D SIDE-LABELS. a = YES. UPDATE a WITH FRAME f. /* UPDATE does DISPLAY, ENABLE, and WAIT-FOR */
I have a toggle-box on the screen with initial value of "no".
I have this code in the main block;
ASSIGN chb_addrtype:CHECKED IN FRAME {&FRAME-NAME} = TRUE.
But when the screen is displayed, the toggle-box is still un-checked. Do you know of a reason?
Thanks,
Setting the CHECKED attribute doesn't change the value of chb_addrtype. The DISPLAY statement will set the state of the toggle-box based on the current value of the variable.
New to programming in progress. Do you have an example please?
And is the place to change the state of this toggle-box the main-block? I mean before the screen is shown.
Thanks,
You need to set the value of the variable, not the property checked.
The display statement displays the data on the screen...if the value of your variable is false, it will be displayed unchecked.
DEFINE Variable chb_addrtype AS LOGICAL VIEW-AS TOGGLE-BOX NO-UNDO.
DEFINE FRAME f
chb_addrtype
WITH THREE-D SIDE-LABELS.
ASSIGN chb_addrtype = Yes.
Display chb_addrtype With Frame f.
Wait-for Close Of This-procedure.
Why should I define the variable & the frame. I already have designed the screen with it's components.
All I want is to change the state of the toggle-box before the screen is displayed when the program is run.
Setting chb_addrtype = TRUE before the screen is displayed will display the toggle-box with a check. You can do this in the main block of your program.
That is exactly what I'm doing, but the toggle-box does not appear to be checked when the screen is displayed.
What could be the cause?
Could you attach your code so we can see it?
You have to use:
ASSIGN chb_addrtype = true.
Not this:
ASSIGN chb_addrtype:CHECKED IN FRAME {&FRAME-NAME} = TRUE.
Thanks My Dear,
That worked fine. No where on the internet or documentation I could find this simple example.