On Fri, Dec 28, 2012 at 7:29 AM, Art Heimsoth <artst...@artheimsoth.com>
wrote:
>> On Thu, Dec 27, 2012 at 8:01 PM, Art Heimsoth
>> <artst...@artheimsoth.com> wrote:
>>
>>>> On Thu, Dec 27, 2012 at 3:50 PM, Art Heimsoth
>>>> <artst...@artheimsoth.com> wrote:
>>>>
>>> Okay, this also appears to be working except for when I attempt
>>> to execute a method from the OK method in the child. I am using
>>> SQL in the child InitCode method okay, and a log method in the
>>> setup of the data, where the log method is in the mother and the
>>> execution of it is in the child method (someMethod) in your
>>> example. Those both work okay. When I attempt to execute the
>>> same log method from the OK in the child, the dialog seems to not
>>> respond anymore until I "X" out of the child dialog.
>>>
>>
>> Which dialog doesn't seem to respond? The parent or the child?
>
> The parent is blocked and beeps when attempting to click on anything
> within it. The child accepts the Ok click, but nothing happens until I
> cancel it with the windows "X" - then all the pending actions for the
> Ok method continue.
Art,
Here is a simple parent / child dialog that will behave as you describe
above:
/* Parent Dialog */
dlg = .SimpleDialog~new
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
::requires "ooDialog.cls"
::class 'SimpleDialog' subclass UserDialog
::method init
forward class (super) continue
self~create(30, 30, 257, 123, "Parent Dialog", "CENTER")
::method defineDialog
self~createPushButton(100, 10, 99, 50, 14, , "Test", onTest)
self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")
self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")
::method log
use arg msg
say msg
::method onTest
dlg = .ChildDialog~new
dlg~data = 'not finished'
dlg~parent = self
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
/* Child dialog */
::class 'ChildDialog' subclass UserDialog
::attribute data
::attribute parent
::method init
forward class (super) continue
self~create(30, 30, 257, 123, "Child Dialog", "CENTER")
::method defineDialog
self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")
self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")
::method ok
self~parent~log('in okay')
self~data = 'finished'
self~parent~log('set data to finished')
self~parent~log('quitting now')
return self~ok:super
The reason it will block when you press ok is that the parent dialog is
executing in the onTest() method, which is guarded. The log() method in
the parent dialog is also guarded.
So when you invoke log() in child dialog's ok() method, the log() method
can not run, because it is guarded and can not gain access to the dialog's
variable pool. It can not run until the onTest() method finishes.
A simple change that fixes this is to make log() unguarded.
::method log unguarded
use arg msg
say msg
This doesn't explain, to me, your statement that moving the method
invocations out of the ok() method allows things to work. I'd have to see
your whole program to understand that.
The other thing that you may not be aware of, is that when you start the
child dialog using execute(), it gets started as a modal dialog. The
parent dialog's user interface is disabled in this case. That is why you
hear the beep.
Now, you may or may not want, the child dialog to be modal. Normally you
use a modal dialog because you do not want the user to be able to interact
with the parent dialog until the user finishes with the child dialog.
If you do want the user to be able to use the parent dialog, you should
start the child dialog with the popup() or popupAsChild() method.
This change will also work:
::method log
use arg msg
say msg
::method onTest
dlg = .ChildDialog~new
dlg~data = 'not finished'
dlg~parent = self
dlg~popUpAsChild(self, "SHOWTOP", IDI_DLG_OOREXX)
If you notice I left the log() method guarded. This works because the
popupAsChild() method returns immediately, so the onTest() method is not
executing when you press Ok in the child.
And finally, the alternative to making the log() method unguarded would be
to make the onTest() method unguarded. This change will also work:
::method log
use arg msg
say msg
::method onTest unguarded
dlg = .ChildDialog~new
dlg~data = 'not finished'
dlg~parent = self
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
--
Mark Miesfeld
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users