Display Data on Parent

cthulhugeek

New Member
Hi,

I was wondering if there was anyway to display data in the parent window, as you are still in the child dialog box. For example if the window had item data showing and while you where in the dialog you choose a new item, could you have the window behind the dialog display the new item info while still in the dialog. Hope this is clear.

progress version 9.1E in windows xp.

Don
 
You just create the windows separately and display information in a trigger but using the other window.

Try something like this:

def var window1 as widget-handle no-undo.
def var window2 as widget-handle no-undo.
def var this_word as char form "x(20)" no-undo.

create window window1.
window1:height = 10 .
window1:width = 40.
window1:col = 1.
window1:row = 1.

create window window2.
window2:height = 10 .
window2:width = 40.
window2:col = 50.
window2:row = 1.


form this_word label "A Word" with frame f1 side-labels three-d 1 down view-as dialog-box.
form with frame f2.
on enter of this_word in frame f1 do:
assign this_word.
display this_word label "The Same Word" with
frame f2 side-labels 1 down three-d in window window2.
end.
view window1.
view window2.
view frame f1 in window window1.
enable all with frame f1.
display this_word with frame f1.
wait-for close of frame f1.

 
This could be achieved by many ways. The basic thing that you need to know is you need to have the handle of the parent window available to do anything over there.

Option1 (traditional way):
------------------------
Run the child-window from parent and input the parent window handle as one of the input parameters to child window.

Try this:
In parent window:
-----------------
Place a fill-in (object name fchar) and a button (object name btn1).
Create a new internal procedure named writeParent. The procedure may look as shown below:

PROCEDURE writeParent:
DEFINE INPUT PARAMETER pcValue AS CHARACTER NO-UNDO.
DO WITH FRAME {&FRAME-NAME}:
END.
ASSIGN fchar:SCREEN-VALUE = pcValue.
END PROCEDURE.

On choose of btn1
DO:
def var hParent as handle no-undo.
hParent = THIS-PROCEDURE:HANDLE.
Run childwindow.w (input hParent).
END.

Child window:
-------------
Place a fill-in in the child window (object name fchild).

In the definition block of child window:
def input param phParent as handle no-undo.

On any-key of fchild
DO:
IF VALID-HANDLE(phParent) AND LOOKUP('writeParent':U, phParent:INTERNAL-ENTRIES) <> 0 THEN
DO:
RUN writeParent IN phParent (SELF:SCREEN-VALUE + KEYLABEL(LASTKEY) ).
END.
END.
-----------
Save both files (parent window and child window).
Run the parent window and launch the child window by clicking the button.
Type in something in the fill-in of child window. You can see the same is reflected in the parent window's fill-in.
=======================
Option 2 (using Publish / Subscribe):
----------------------------------
You can subscribe an event in parent window which writes the value received thru input parameter and publish the same event from child window.

Option 3 (using set/get userproperties):
--------------------------------------
Use setUserProperty and getUserProperty functions to define user defined user-properties with custom values. However, this is not a good approach since you (as a developer) has to make sure the userProperty which is being is used is never used before.

Hope this helps.
 
Back
Top