This is definitely a logic error on their part.  Exposed instance variables exist within the scope of the class that owns the methods doing the expose.  The DlgData. used by the init method exists in the scope of the PlainBaseDialog class.  The DlgData exposed in executeAsync is owned by the DialogExtensions class.  They are different variables (as you've discovered).  The appropriate fix would be to define an accessor method in the PlainBaseDialog class and give it private scope:

::method getDlgData private
  expose DlgData.
  return DlgData.

The executeAsync method can then do

  DlgData. = self~getDlgData

rather than exposing the variable.


On 5/31/07, Mark Miesfeld <> wrote:
I am not sure I understand how the use of "exposed" variables in objects should work.

There is a problem in ooDialog where something the original developers expected to work, doesn't work.

I'm not sure if this is a logic error on their part, of if ooRexx is not working correctly.  Maybe Rick can clear this up.

Below is: print out showing the problem running an example program and then a class diagram.  I added some say statements to the ooDialog classes to trace what is happening.  
The basic problem is that in executeAsync, the exposed DlgData. stem is not set, whereas in execute it is set.  Obviously, the original developer(s) expected it to be set in both places.
In PlainBaseDialog there is the construct:
::method init
  expose DlgData.
  use DlgData.
In both execute and executeAsync there is the construct:
  expose DlgData.
  do something with DlgData.
The executeAsync is a method of DialogExtensions, which is a mixin class.  So, the quesion is:  should DlgData. be set in correctly when executeAsync runs?  It seems to me it should, but since it is a mixin class, I'm not sure.

initData.1000 set to: Bamboo
Using execute() to run dialog

In Init UserDialog arg(1)[1000] Bamboo
In init PlainBaseDialog, DlgData.1000: Bamboo
In Execute DlgData.1000: Bamboo
In SetDataStem dataStem.1000 Bamboo

C:\work.ooRexx\DlgData.wrong>dlgData.rex 1
initData.1000 set to: Bamboo
Using executeAsync() to run dialog

In Init UserDialog arg(1)[1000] Bamboo
In init PlainBaseDialog, DlgData.1000: Bamboo
In ExecuteAsync DlgData.1000: DLGDATA.1000
In SetDataStem dataStem.1000 DLGDATA.1000


Here is the class hierarchy:

   *-------------------*        *--------------------*
   |                   *--------* Init()             |
   |  PlainBaseDialog  |        |   expose DlgData.  |
   |                   *---*    |   use DlgData.     |
   *---------*---------*   |    *--------------------*
             |             |
             |             |    *--------------------------*
             |             *----* Execute()                |
             |                  |   expose DlgData.        |
             |                  |   DlgData.1000 -> Bamboo |
             |                  *--------------------------*
   |                   |
   |    BaseDialog     |
   |                   |
   *---------*---------*  *--------------------*
   |                   |  | DialogExtensions   |
   |   UserDialog      *--*   Mixin Class      |
   |                   |  |                    |
   *---------*---------*  *-*------------------*
             |              |
             |              |  *--------------------------------*
             |              *--* ExecuteAsync()                 |
             |                 |   expose DlgData.              |
             |                 |   DlgData.1000 -> DLGDATA.1000 |
             |                 *--------------------------------*
   |                   |
   |  EntryLineDlg     |
   |                   |
Mark Miesfeld

This email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
Oorexx-devel mailing list