gettingstarted
[Top] [All Lists]

Re: Class Reference Problems

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Class Reference Problems
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Sat, 26 Feb 2005 18:29:23 -0600
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <20050222234319 dot 1D81674C4D4 at lists dot realsoftware dot com> <30c65373382a3a73eb8869e64fb7863b at comcast dot net>

On Feb 26, 2005, at 5:41 PM, Scott Goelzer wrote:

I think the problem is how the canvas super class is addressing the listbox super class. The call I am using from the canvas superclass is:

datawnd.listbox1.whateverIneeded

DataWnd is always going to be the instance created automatically for you by simply referencing it. Instead, either of these two approaches would work better (although there are many other solutions):

1) Make your Canvas subclass simply expose events that you can write implementations for on the windows you need it on. This makes it easier to keep your canvas reusable among many projects. 2) Put a property on your Canvas subclass such as "Owner as DataWnd". Then, inside of your canvas, simply reference "Owner". All you need to do is set this property up in your open event such as:

MyCanvasClass's Open Event on the Window:
Sub Open()
  me.Owner = Self // me is the canvas, Self is the DataWnd instance
End Sub

HTH,
Jon


--
Jonathan Johnson
REAL Software, Inc.

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>