DEFINE VARIABLE f$x AS DECIMAL NO-UNDO.
DEFINE VARIABLE f$y AS DECIMAL NO-UNDO.
RUN dispatch IN h_f-frame /* Destroy current frame */
('destroy':U).
RUN init-object IN THIS-PROCEDURE
(INPUT 'frame-filename',
INPUT FRAME F-Main:HANDLE ,
INPUT 'Layout = ':U ,
OUTPUT h_f-frame ).
RUN get-size IN h_f-frame
(OUTPUT f$x,
OUTPUT f$y).
IF f$x <= FRAME {&FRAME-NAME}:WIDTH THEN
ASSIGN f$x = (FRAME {&FRAME-NAME}:WIDTH - f$x) / 2.
ELSE
ASSIGN f$x = 0.
RUN set-position IN h_f-frame
( f$y , f$x ) NO-ERROR.
RUN dispatch IN h_f-frame
('initialize':U).
PROCEDURE add-link:
DEFINE INPUT PARAMETER p-link-source AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER p-link-type AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER p-link-target AS HANDLE NO-UNDO.
jeisma said:Hello,
I have smart window, can i at run time create a link and draw
a smart frame into it?
Regards!
Progress 9.1D
RUN add-link IN adm-broker-hdl
( p-link-source ,
p-line-type ,
p-link-target ).
bendaluz2 said:This is what I use to change the frame displayed on a window
You should also be able to use add-link to create smart links at runtime:Code:DEFINE VARIABLE f$x AS DECIMAL NO-UNDO. DEFINE VARIABLE f$y AS DECIMAL NO-UNDO. RUN dispatch IN h_f-frame /* Destroy current frame */ ('destroy':U). RUN init-object IN THIS-PROCEDURE (INPUT 'frame-filename', INPUT FRAME F-Main:HANDLE , INPUT 'Layout = ':U , OUTPUT h_f-frame ). RUN get-size IN h_f-frame (OUTPUT f$x, OUTPUT f$y). IF f$x <= FRAME {&FRAME-NAME}:WIDTH THEN ASSIGN f$x = (FRAME {&FRAME-NAME}:WIDTH - f$x) / 2. ELSE ASSIGN f$x = 0. RUN set-position IN h_f-frame ( f$y , f$x ) NO-ERROR. RUN dispatch IN h_f-frame ('initialize':U).
Code:PROCEDURE add-link: DEFINE INPUT PARAMETER p-link-source AS HANDLE NO-UNDO. DEFINE INPUT PARAMETER p-link-type AS CHARACTER NO-UNDO. DEFINE INPUT PARAMETER p-link-target AS HANDLE NO-UNDO.
jeisma said:Hello!!
what i really would like to do is:
1. create a single smart window.
2. create several smart frames, which would contain all modules of my application.
3. this frames will have to be linked to the smart window at run time. which frame will be linked will depend on what the user chooses from an options menu.
essentially, im trying to create an application with only one window. i'll just snap a frame into it when needed.
what do u think?
thx!
bendaluz2 said:Yes this is perfectly possible using remove-link and add-link to move the link to the frame that is required for the particular operation. You can also use the frame change code I posted to change the frame that is shown on the window rather than just hiding the unused ones and displaying the relevant one. This has the advantage that less memory is used and the application will respond a lot faster as there are less widgets for progress to deal with. This is especially noticable when many frames are used within the application
jeisma said:hi!
im a little stumped about implementing this.
if at designed time you link a smart frame to smart window, progress creates an h_ handle variable.
how would u do that if you do that at run time?
thx!!