On Dec 17, 2006, at 9:48 AM, David Johnson wrote:
Message: 2
Subject: Re: Creating a canvas control
From: Terry Ford <[EMAIL PROTECTED]>
Date: Sat, 16 Dec 2006 15:05:28 -0800
On Dec 16, 2006, at 1:46 PM, David Johnson wrote:
I am trying to create a canvas-based control CLASS that has other
controls on it as child controls (e.g, a control array of
editfields).
I can create the control in a window, but I don't know how to then
export it to create a new class. Dragging the canvas with its
children to the desktop or to the project window doesn't work.
I can create a sub-class of Canvas, but then I don't know how to
add other controls on top of it that become part of the class.
Adding controls to the canvas as properties doesn't seem to work; I
can't get them to display on the canvas.
Am I overlooking something, or is what I am trying to do not
possible?
What you are probably looking for is a ContainerControl. (Pro only)
Terry
Terry,
I apologize, I should have mentioned in my post that I am running
RB 5.5 Pro under MacOS X 10.3.9.
My controls window only has an "OLEContainer Control (Windows)".
Is the ContainerControl an addition to RB after version 5.5?
The reason I thought that this was possible was that, in the RB 5.5
Lang. Ref, the Canvas control has a Scroll method that takes an
optional ScrollControls parameter. The LR says, "ScrollControls
indicates whether controls positioned on top of the Canvas control
should be scrolled as well. ScrollControls is True by default."
But, perhaps this applies only to controls built on a canvas "by
hand".
But, if it is possible to create a sub-class of Canvas with child
controls in RB 5.5 Pro, how do I do it?
As Terry mentioned, ContainerControls are designed to provide the
capability that you're after. Without ContainerControls, you will
have to have the controls(at least one, if you plan to clone) already
on the Window. You can assign these controls to the subclass within
an Open event.
So, add a property or properties to your subclass which can hold a
reference to the controls. For example, with a single editfield for
simplicity, add a property MyEditfield as editfield to your subclass.
Use this property name(MyEditfield) in your code within the subclass.
Drag an EditField1 onto the Window. Then, in the Open event of the
Window you can assign EditField1 to the canvas: Canvas1.MyEditField =
self.EditField1, where Canvas1 has your custom canvas class as its
Super.
Best,
Jack
_______________________________________________
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>