home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
PRNTCHLD.E
< prev
next >
Wrap
Text File
|
1996-05-21
|
2KB
|
51 lines
; Sample code for setting up a parent-child relationship between two
; edit windows. The initial edit window issues an OpenChild command,
; which opens another edit window and sends in a ParentWindow command,
; giving the initial edit window's handle as an argument. The new window
; responds to this command by sending back to the parent window the
; child's window handle. At this point, two-way communication is
; possible.
; Note that this need not be included in the base macros; if
; desired, it can be a separate linkable .ex file, and the child
; can be told to link it dynamically: openchild 'link prntchld'
; By: Larry Margolis
compile if not defined(TRUE)
include 'stdconst.e' -- Required to define EPMINFO_EDITCLIENT
compile endif
; The following command opens a new edit window and passes it a command
; telling it what the current window's handle is.
defc openchild -- accepts an optional list of files to edit and/or cmds
'open' arg(1) "'parent_window" getpminfo(EPMINFO_EDITCLIENT)"'"
; This command is telling us what the parent window's window handle is;
; we respond by telling it our window handle. In a more complicated
; scenario, involving multiple children, the openchild command could
; have passed in an index as well as the parent's window handle, and
; we could respond with that index as well as our (the child's) own
; window handle, or we could send back the file name in addition to
; the window handle if you wanted the parent to keep track of children
; by name.
defc parent_window
universal parent_hwnd
parent_hwnd = arg(1)
; sayerror 'Parent window handle is' parent_hwnd
cmd = 'child_window' getpminfo(EPMINFO_EDITCLIENT)
call windowmessage(0, parent_hwnd,
5377, -- EPM_EDIT_COMMAND
put_in_buffer(cmd),
1) -- Flag to free the buffer
; This command is received from a child window by a parent window;
; it simply records the window handle for future use. If multiple
; children were involved, it would parse off the index and filename
; and keep track of them in an appropriate manner (possibly in an
; EPM array).
defc child_window
universal child_hwnd
child_hwnd = arg(1)
; sayerror 'Child window handle is' child_hwnd