This certainly seems to be a bug. 3 scripts, first main_test1
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
again:
DO FOREVER
guigetmsg()
IF EXISTS('GuiObject') \== 0 THEN DO
IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)
END
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
wm_click_start_child1_button:
arg_string.0 = 1
arg_string.1 = 'This is the first line'
createobject("main_child1.rex", 'child1.')
RETURN
wm_click_start_child2_button:
arg_string.0 = 1
arg_string.1 = 'This is the first line'
createobject("main_child2.rex", 'child2.', ,guiwindow, arg_string., 0, 'My title for main child2')
RETURN
and now main_child2
create:
USE ARG parent_window, arg_string., modal, title
guierr = "SYNTAX"
guiheading = 1
IF modal = 0 THEN modal = ''
createwindow:
IF modal = '' THEN
guicreatewindow('HIDE', parent_window)
ELSE
guicreatewindow('HIDE', -1)
IF title \= '' THEN
guiaddctltext(, title)
guisetctlvalue()
guisetctlplacement(,,,,,,'NORMAL')
RETURN
destroywindow:
destroy:
guidestroywindow()
RETURN
wm_click_ok_button:
guisay('Clicked on OK button')
RETURN
finally, main_child1.
create:
USE ARG arg_string.
guierr = "SYNTAX"
guiheading = 1
createwindow:
guicreatewindow('SHOW')
RETURN
destroywindow:
destroy:
guidestroywindow()
RETURN
wm_click_ok_button:
guisay('Clicked on OK button')
RETURN
Start RPC, open main_test1 and run it. Select "Start child2".
Notice how if you put focus on the main window it isn't brought to the fore. Move child2 out of the way and select child1. Now put focus on the main window -this time it WILL be brought to the fore.
It seems to be something to do with passing the handle for the main window. If you change the line in main_test1 fromcreateobject("main_child1.rex", 'child1.') tocreateobject("main_child1.rex", 'child1.' , ,guiwindow) then child1 will behave the same way as child2.Michael |