I want to creat widgets at runtime and save the window using PROGRESS appbuider or User Interface Buider. Pleas give me some hints and places to get help.
You can only do this using 4gl code and its impossible to have your dynamic widgets visible in design mode.
This example will create a dynamic button:
Create an empty (smart) window or use an existing window.
Create a new procedure in the section editor.
Add the following code:
DEFINE VARIABLE hn AS WIDGET-HANDLE NO-UNDO.
CREATE BUTTON hn
ASSIGN X = 10
Y = 10
WIDTH-PIXELS = 100
HEIGHT-PIXELS = 20
LABEL = "button"
VISIBLE = TRUE
FRAME = FRAME {&FRAME-NAME}:HANDLE
TRIGGERS:
ON CHOOSE PERSISTENT RUN VALUE ('doSomething') IN THIS-PROCEDURE.
END TRIGGERS.
ASSIGN hn:SENSITIVE = TRUE.
Create an override of the 'createObjects' procedure (smartwindow) and add a 'run' of the created procedure behind the 'RUN SUPER' statement, or place this code in the main-block behind the 'enable-ui' statement (simple window).
Add a procedure 'doSomething' which contains the actual trigger code.
Although this button isn't really dynamic, you can make all 'hardcoded' stuff in here variable- of parameterbased. And by using an array or temp-table construction for your handles you can add as many buttons or other widgets as you wish.
Remember that when using dynamic widgets you have to free the object if you're done with it. When your window runs persistent all the time and new objects are generated and removed you have to use the
DELETE WIDGET <handle> to remove them!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.