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. I tried the following modification:

Sub AddRow()
  Dim newControl as ControlClass

  newControl = new window1.ControlClass1  // clone the existing control

  if (newControl <> nil) then

   // initialize the new control //

  end if

The error changed to: "This method requires more parameters than were passed." The constructor for ControlClass does not take any parameters.

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


2. When it comes time to call the method from anotherControlClass, the call is as follows:

  window1.Addrow

This works, but I would like to localize the code so that anotherControlClass does not need to know the name of its parent window (so that anotherControlClass can be added to any window).

The following:
  me.window.Addrow
  window.Addrow
  window(0).Addrow     (the application has only one window)
all give the "This method or property does not exist" error.

The anotherControlClass.window property does access the ordinary window items like .top or .visible, but it cannot access any properties or methods that I have added to the window.

Is there a way to call a window method from another class without hard-coding the window name?


These are driving me crazy, so thank you in advance for any help you can give.

RB5.5 Pro,  MacOSX 10.3.9

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