On Aug 9, 2006, at 9:01 AM, D P wrote:
Hi all
I've a very newbie question here I'm sure but that is why I am on
the gettingstarted list.
I'm trying to code the existance of controls on a window so that
I can add them as needed at runtime. What I tried on a clean
window's Open event was as follows:
dim a as new EditField
a.enabled = true
a.top = 10
a.left = 10
a.Width = 100
a.Height = 25
a.BackColor = &cFFFFFF
a.MultiLine = true
a.border = true
a.text = "Test text"
a.visible = true
It compiles and the window opens but I see no control. I was used
to VB6 when I could just use LOAD. I guess my question is: can I
do it this way and if not is there another way besides using
containers.
In REALbasic you cannot create a control at runtime. You *can* clone
an existing control however if that control has an Index Value
(preferably Index 0). This control can be invisible or off screen if
you wish an empty project at startup.
You can do this many times if you so wish and you can refer to
individual clones by their index value. Any property that is not read
only (identified by locks in the LR) can be changed or se at runtime.
In the above code example, MultiLine and Border cannot be changed and
must exist in the original. You could have several EF's ready to be
cloned though and still invisible or off screen to cover that. Check
out the LR for what you can do and look into the User's Guide in
Chapter 5 for "Creating New Instances of Controls On The Fly".
HTH,
Terry
_______________________________________________
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>