Runtime link a smart frame to a smart window

jeisma

New Member
Hello,

I have smart window, can i at run time create a link and draw
a smart frame into it?



Regards!


Progress 9.1D
 
If you mean "Can I decide at run-time, which SmartFrame to display?", then yes you can.

SmartFrames are always displayed on logical ADM pages. Objects placed on page zero are always visible. Object placed on other pages are visible only when you select that page using the selectPage or viewPage methods.

To change which object is displayed on a page, you can use the 'Parameterize as Variable' feature. Place your initial SmartFrame down on a page, then right-click and select Properties. From the properties page you can specify the name of a variable which will hold the file-name of the SmartFrame that you want to display when the page is selected.

At run-time, you can change the value of the variable and so change the actual object that is displayed. If you want to change the object more than once, first use the deletePage method, then change the variable value. The next time that the page is displayed (using selectPage, viewPage or a tab-folder control) the object currently defined by the variable will be displayed.
 
This is what I use to change the frame displayed on a window
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).
You should also be able to use add-link to create smart links at runtime:
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,

I have smart window, can i at run time create a link and draw
a smart frame into it?



Regards!


Progress 9.1D
 
Also, note that the add-link functionality is contained within the broker, so it should be called with
Code:
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
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).
You should also be able to use add-link to create smart links at runtime:
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.
 
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!
 
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:
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!
 
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!!


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
 
You stick a default frame on your window, one that it will start up with. When you want to change to another frame, you run the frame change code from my first post, which destroys that frame and then puts the new frame on the window in place of the old one, using the same handle.

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!!
 
Back
Top