I might also add that if you're doing manual unwrapping, you might also want to use a different variable name to avoid unintentional conflicts.
Rick On Tue, Sep 8, 2009 at 1:41 PM, Mark Miesfeld<miesf...@gmail.com> wrote: > On Mon, Aug 24, 2009 at 4:13 PM, Rick McGuire<object.r...@gmail.com> wrote: > >> Nope, in that definition, if the CSELF variable is set in the >> DialogControl class, it will hide the one set by the WindowBase class >> for all methods because that will be the first scope searched for the >> variable. This essentially saws off the one involved with WindowBase. >> You can still access each of these different CSELF incarnations, but >> you'll need to manually retrieve the CSELF variable using >> GetObjectVariable() and do the unwrapping of the value yourself. >> >> The changes required for this are fairly trivial, but there is one >> gotcha. The ObjectToCSelf() API doesn't have a starting scope, >> because there's no method context involved when you are potentially >> accessing a CSELF value in another object. I suspect we'll need to >> add an API that also allows the scoped lookup of the CSELF value. > > I sort of hit a dead end here, maybe relating to needing an API that > allows a scoped lookup of the CSELF value, or some other thing I don't > understand. > > I essentially want to do this in UserDialog::init(). Forward to the > superclass init() and on return get the CSelf pointer: > > RexxObjectPtr result = c->ForwardMessage(NULL, NULL, super, newArgs); > > pCPlainBaseDialog pcpbd = (pCPlainBaseDialog)c->ObjectToCSelf(self); > > where the class hierarchy is this: > > ::class PlainBaseDialog inherit Windowbase > ::class BaseDialog subclass PlainBaseDialog > ::class UserDialog subclass BaseDialog > > On return from the forward call in UserDialog::init(), I expected to > get the CSelf pointer set in PlainBaseDialog, but instead I get the > CSelf pointer of WindowBase: > > UserDialog::init() enter > BaseDialog::init() enter > PlainBaseDialog::init() enter > initWindowBase() enter > initWindowBase() unwrapped WindowBase cself=000007FFFF028840 > PlainBaseDialog::init() setting CSELF unwrapped cself=000007FFFF099EA0 > BaseDialog::init() returning 0 > UserDialog::init() got unwrapped cself=000007FFFF028840 (ObjectToCSelf(self)) > > So, in UserDialog::init() I get an unwrapped CSelf pointer, but it is > the one set in WindowBase::init() rather than the one set in > PlainBaseDialog::init() > > I thought the inheritance chain would be: > > UserDialog -> BaseDialog -> PlainBaseDialog -> WindowBase > > and so the CSelf set in PlainBaseDialog would be before the one set in > WindowBase, and first one wins. > > (I actually ran into this last week in a similar circumstance, but > just worked around it for now so I could continue to make progress. > But, here there is no good temp work around.) > > I'm not really sure of what to expect here. > > -- > Mark Miesfeld > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Oorexx-devel mailing list > Oorexx-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel