design time

Hey,
I have DO loop with the VAR from which I would like to hide a frame. I have named the frames with numbers for this reason eg frm_1, frm_2 ... However I do not know the syntax to use at design time. Eg
Do i = 1 to 5
frm_**number that i is currently on in my loop**:VISIBLE = FALSE.
END.
Because I do not know the number at design time how do I code to make Progress use the VAR value?
Is it something likefrm_ VALUE(var) ?
Cheers. Regards
 
The name of a frame is a static definition. This means that you can refer to a frame by its name only within source code. You can't generate the name at run-time. Progress 4GL code must be compiled before it is run. So trying to reference a frame by its name by building the name at run-time will not work because the compiler doesn't have a clue what you mean.

To get something similar to what you want, you will need to place the handle of each frame in an array. You can then using a DO loop to reference a frame by its handle. For example:

DEF VAR hFrames AS HANDLE NO-UNDO EXTENT 5.

/* These are the static references to the frames */
ASSIGN hFrames[1] = FRAME FRAME-A:HANDLE
hFrames[2] = FRAME FRAME-B:HANDLE
...

/* This is the dynamic refernce to the frames */
DO i = 1 TO 5:
ASSIGN hFrames:VISIBLE = FALSE.
END.

Note that unless you actually create the frame dynamically at run-time, you will ALWAYS need some kind of static reference to it before you can manipulate it dynamically (e.g. using its handle).

So unless you have a significant number of frames/widgets to control within the loop, it's hardly worth doing this.
 
I am NOT creating the frames dynamically, ie at run time. The frames have already been created and all I need is the syntax to reference these frames at runtime because I have stored their names sequentially so I can loop through and easily refference the name using my loop var. I just do not know the syntax to use at design time.
 
You misunderstand. You are trying to make a static definition to a frame by building the name dynamically - at run-time. This isn't allowed in any language that I know of.

Try to think of it this way. The name that you give a frame is for use within the source code only - before compilation. When the code is compiled, Progress translates that name into memory address. So in the compiled code, the frame is accessed only by its address and not by the name that you give it. The compiler looks for all the references to the frame by its name within the source code and translates these names into the same address.

So at run-time, Progress recognises the frame only by its memory address and not by its name. Therefore, it would be pointless to try and create code that loops around frames by their name.

There is no syntax that you can use at design-time.
 
Well,

you could make a procedure for each frame you could ever possibly be wanting to hide, make all the frames shared frames, and run the 'hidefr_##.p' program to hide the frame of your choice.... but that would be a silly thing to do...

it could be done with run-time compilation and passing of parameters as well i guess, so you wouldn't have to write a seperate program for each frame you'd want to hide, but i think i'll stop with this weird explaination, before anyone suspects me of programming this way...
 
Gee - I'm not sure if this is what you're looking for on not but this will hide all the frames and then display a different one each time it goes through the do loop.

def frame f-1
'1'.


def frame f-2
'2'.


def frame f-3
'3'.

def frame f-4
'4'.

def frame f-5
'5'.

def var i as int no-undo.

do i = 1 to 5.
frame f-1:visible = no.
frame f-2:visible = no.
frame f-3:visible = no.
frame f-4:visible = no.
frame f-5:visible = no.
case i:
when 1
then frame f-1:visible = yes.
when 2
then frame f-2:visible = yes.
when 3
then frame f-3:visible = yes.
when 4
then frame f-4:visible = yes.
when 5
then frame f-5:visible = yes.
end case.
pause.
end.
 
Back
Top