On Wed, Jan 14, 2009 at 6:54 PM, Rick McGuire <object.r...@gmail.com> wrote:
> 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. Thanks Rick. I'm thinking on it. <grin> I may not have been clear here, I'm not trying to distinguish between the different control types, but rather if self is PlainBaseDialog (subclass) object or if self is a DialogControl (subclass) object. There are other ways to do that, I was just surprised that IsOfType() did not produce the result I expected. In the implementation of getTextSize() I need the dialog object. If self is already a dialog object than fine. If self is a dialog control object then it holds a reference to the parent dialog object. I can get the parent dialog object through dialogControl~oDlg(). In pseudo-code it comes down to: if self~IsOfType(PlainBaseDialog) then dlgObj = self else if self~hasMethod(oDlg) then dlgObj = self~oDlg else ERROR Whereas what I did have was: if self~IsOfType(DialogControl) then dlgObj = self~oDlg else if self~isOfType(PlainBaseDialog) then dlgObj = self else ERROR And I kept getting ERROR when I knew self was a DialogControl. -- 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