Message: 5
Subject: Re: window references
From: CV <[EMAIL PROTECTED]>
Date: Sun, 28 Jan 2007 13:59:02 -0800


On Jan 27, 2007, at 10:37 PM, David Johnson wrote:

I have two related problems.

1.  I am generating a control array on the fly with the following
code:
Sub AddRow()
  Dim newControl as ControlClass

  newControl = new ControlClass1  // clone the existing control

  if (newControl <> nil) then

   // initialize the new control //

  end if

This code works only if it is a method of the window,
window1.Addrow. If this same method is placed in a module or in a
class, it generates a "This method or property does not exist"
compile error.

[snip]
If it is possible, how do I add controls to a control array from an
object other than the window?


It's logical that the method, AddRow, belong to the window. Another
object can tell the window to execute the method. You can include
parameters in the declaration of AddRow which will allow you to set
attributes in the call from the other object.


So, the code that clones a control *must* be in a method of the enclosing window. OK.

[snip]

To gain access to the members not included in Window class, the other
class needs a reference to the window instance which has been
dimensioned or cast to the class of the instance, or to an Interface
implemented by the instance's class in the case of methods. This
means, generally, that the window name, or the name of its superclass
if it has one, or its Interface if it implements one, is going to
appear in the other class somewhere, perhaps in a declaration or as
an IsA argument and/or a cast.

[snip]

So, for a class to access a custom window property or method, the window name must be hard-coded *somewhere* in the class.

Thank you for clarifying these; I understand better now.

Thanks,
David

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

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

Reply via email to