Well, the best design pattern for something like this would be not do
the test for the control type, but have a method call at the point
where you need to distinguish between the objects and have the
dialogcontrol override that method to produce the different behaviour.
 Another approach might be to have a mixin class that's defined in the
first package and have dialogcontrol implement that.  So rather than
test for dialog control, which the base class should have no knowledge
of, it's testing whether the class has been marked as being special.

Rick

On Wed, Jan 14, 2009 at 8:29 PM, Mark Miesfeld <miesf...@gmail.com> wrote:
> Rick,
>
> I'm having what I assume is a scoping problem using the native API and
> can't figure out how to do what I want.
>
> In Rexx I can do this:
>
>  stFont1 = self~getStaticControl(IDC_ST_FONT1)
>
>  say 'Static control:' stFont1 'is a DialogControl?'
> stFont1~isA(.DialogControl)
>
> and get this output:
>
> Static control: a StaticControl is a DialogControl? 1
>
> The next line of Rexx code is
>
>  parse value stFont1~getTextSize("My name is Mark", "Ms Shell Dlg 2",
> 8) with cx cy
>
> where getTextSize() is implemented as a native API method
>
> In the API method, I essentially need to do a OSELF
> self~isA(.DialogControl), but have problems.  Print out from the C++
> code:
>
> object id: a StaticControl
> object is instance of DIALOGCONTROL (context class)? 0
> object is instance of DIALOGCONTROL (package class)? 0
> object is of type     DIALOGCONTROL                ? 0
>
> (Trying to get the package class was just grasping at straws.)
>
> In the Rexx code I can tell the static control is a DialogControl, it
> seems there should be a way to tell in the native API method.
>
> Here is a summary of the class hierarchy, which I know is the cause of
> this, I just want to get around it if I can:
>
> In 'oodplain.cls'
>
> ::class WindowBase public mixinclass object
> ::method getTextSize
>
> ::class PlainBaseDialog ... inherit WindowBase
>
> In 'oodwin32.cls'
>
> ::class DialogControl ... inherit WindowBase
>
> ::class StaticControl subclass DialogControl
>
> If I change:
>
> stFont1~getTextSize(...)
>
> to
>
> self~getTextSize(...)
>
> then in the C++ code the test IsOfType(PlainBaseDialog) returns true.
>
> I can see, dimly, what is going on I think.  PlainBaseDialog and
> WindowBase are defined in the same package file.  While DialogControl
> is defined in package file that WindowBase knows nothing about.
>
> But, since in the Rexx code I can do: stFont1~isA(.DialogControl) and
> get the right answer, I'm thinking there is some way to do it in the
> native API, if I just use the right approach.
>
> --
> Mark Miesfeld
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to