Tim, Tom and the others,


Thanks it works. I finally decided to go throught a Loop (more in my knowledge).


Youri




Tim Hare wrote:
Then you want to loop through the controls and look for the name of the
control.

// ef is the myEditField you found
dim s as string
dim i as integer

s= "ov_"+ mid(ef.name, 3)

for i= 0 to ControlCount-1
   if control(i) isa Oval then
      if Oval(control(i)).name = s then
         Oval(control(i)).Visible= true
         exit
      end
   end
next


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Youri
Sent: Tuesday, December 26, 2006 7:53 AM
To: REALbasic NUG
Subject: Re: Accessing Controls programatically


Terry,


I have created the different Oval and given them appropriate names (ie.
ov_Name, ov_Surname etc…) and set their visibiity to "false".

I want now to be able to point to the correct Oval depending on the name
of the MyEditfield.

As I want the code to be Generic, I need a way to say :

if I test a Myeditfield of which Myeditfield.name = ef_xxxx

then I want to access :

ov_xxxx



Cheers,


Youri



Terry Ford wrote:
On Dec 26, 2006, at 6:44 AM, Youri wrote:

I'd like to be able to make an Oval control visible/invisible
programatically.

For instance I loop throught all my controls (MyEditfields) and if one
of them (let's say ef_Name) has its property "Compulsory" as boolean
set to "True" but is empty, then I want to access the Oval ov_Name and
set its property "Visible" to "true".
That's easy with' ov_Name.Visible=True' as you have below.

The hard part is that the control must already exist at least once and
have an index so that you can clone it. You cannot create a control on
the fly easily (except using a ContainerControl) but you can clone any
already existing control if it has an index property (usually
"0"). This
control can even be off-screen or already invisible. See page
303 of the
User's Guide.

Something in the flavour of :

dim s as string

if ef_Name.iscompulsory = true and ef_Name.text = "" then

  s = "Name"
So far; so good.

  dim a as New Oval
  a.name = s
  a.visible = true
You cannot do this directly. You must create the clone from an existing
control by using it's name.

For example, you have an Oval named "MyOval". It has an Index of "0".

At runtime you can say.

Dim a as Oval
a= New MyOval
a.Top= XX //Set its top position
a.Left= XX //Set its left position
a.Visible=True

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>

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.28/604 - Release Date:
12/26/2006 12:23 PM

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.28/604 - Release Date: 12/26/2006
12:23 PM

_______________________________________________
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>


_______________________________________________
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