Consultor Eletrônico



Kbase 15813: How to run SmartWindows from other SmartWindows
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
How to run SmartWindows from other SmartWindows

How to run SmartWindows from other SmartWindows?
------------------------------------------------

There are different ways that this can be done and each of
the following are addressed in this knowlegebase entry:

1. Put windows on pages
2. Run window-1.w persistent...
3. Run init-object


Putting Windows on Pages
------------------------
One way to implement multi-window applications is to place
a SmartWindow on a page of another SmartWindow. You can then
instantiate the second window by simply switching to another
page. This solution is highly recommended due to its simplicity.
Specific guidelines on how to implement this can be found
in the entry 15414:
'Multiple Windows and Pass-through links in version 8'

Refer to knowledgebase entry 16749: 'How to Apply Focus to a
SmartWindow Run With Select-Page' for how to apply focus to a
SmartWindow run with this approach.

Run Windows Persistently
------------------------
If you have many windows, you may find that the above method
may be slow in the UIB during the design phase. You may
be tempted to simply use the RUN ..PERSISTENT command.

You can do the following:

Run window-1.w persistent set w-handle.
Run dispatch in w-handle ('initialize').

This will work fine for running the window stand-alone
but you will not have any parenting relationships or
container links set up for you which means that the child window will
not be destroyed or hidden when the parent window is destroyed or
or hidden. For your purposes, you may not need these container links
and may find that this approach works fine for you. Or, you can set
up the CONTAINER links (or any other kind of links) yourself;
for example:

run add-link in adm-broker-hdl (this-procedure,
'CONTAINER', w-handle).

** For details on how to apply focus to the 2nd window, please see
the section in this knowledgebase entry on Setting Focus.

Run Init-object
---------------
Running init-object will run the window persistently
and set up all of the container links and parenting
relationships for you. You will still have to run
initialize also. Here is an example of how to do this:


RUN init-object IN THIS-PROCEDURE (
INPUT 'source/w-window.w':U ,
INPUT {&WINDOW-NAME} ,
INPUT '':U,
OUTPUT h_window).


/* add any SPECIAL links you may have */
/* NOTE: CONTAINER links are set up for you by init-object */
run add-link IN adm-broker-hdl (this-procedure, 'state',
h_window).

/* initialize the window */
run dispatch in h_window('initialize').

/* save the window handle */
h_window = h_window:current-window.

Setting Focus in 2nd Window (8.1A only)
===========================

To apply focus to a simple object such as a fill-in in the 2nd window,
please see the kbase entry 16749 titled 'How to Apply Focus to
a SmartWindow Run with Select-Page'.

To apply entry to a smartObject in Window2 you can set up a special
link across which you can send an apply-entry message.

This can be done by augmenting the above-mentioned code as follows:
RUN init-object IN THIS-PROCEDURE (
INPUT 'source/w-window.w':U ,
INPUT {&WINDOW-NAME} ,
INPUT '':U,
OUTPUT h_window).


/* add any SPECIAL links you may have */
/* NOTE: CONTAINER links are set up for you by init-object */
run add-link IN adm-broker-hdl (this-procedure, 'state',
h_window).

/* SET UP SPECIAL LINK FOR SENDING APPLY ENTRY MESSAGE
run add-link in adm-broker-hdl (this-procedure, 'entry-link', but
1).

/* initialize the window */
run dispatch in h_window('initialize').
/* save the window handle */
h_window = h_window:current-window.

/* SEND THE APPLY-ENTRY MESSAGE TO THE TARGET WE SET UP */
run notify in this-procedure('apply-entry, entry-link').

Now, you need to create a local-apply-entry procedure in smartWindow
B and add the following code after the standard 'apply-entry`:

run dispatch in <handle of smartobject in window2> ('apply-entry`).

Progress Software Technical Support Note # 15813