Xojo Conferences
XDCMay2019MiamiUSA

Dynamic Generation of Controls (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: ListBox resize question
Next thread: Questiom from a newbie


RB Database   -   tom.russell transport.alstom.com
  Dynamic Generation of Controls   -   Adam Voigt
   Re: Dynamic Generation of Controls   -   Joseph J. Strout
    Re: Dynamic Generation of Controls   -   Adam Voigt
   Re: Dynamic Generation of Controls   -   Jim Dossey
    Re: Dynamic Generation of Controls   -   Adam Voigt
    Re: Dynamic Generation of Controls   -   Adam Voigt
   Re: Dynamic Generation of Controls   -   Phil M
    Re: Dynamic Generation of Controls   -   Adam Voigt
   Re: Dynamic Generation of Controls   -   Jim Dossey
   Re: Dynamic Generation of Controls   -   Jim Dossey

Dynamic Generation of Controls
Date: 04.02.05 16:18 (Fri, 04 Feb 2005 10:18:32 -0500)
From: Adam Voigt
Hey, I'm getting started with a test project with Real Basic and I'm
running into a problem generating controls on the fly. Here's what I have:

Dim blah As StaticText
blah = New StaticText
blah.Top = 20
blah.Left = 20
blah.Text = "hi there"
blah.Visible = TRUE
Window1.Refresh()

But the control doesn't appear. I'm very new at RB so I'm sure I'm just
missing something simple, but I couldn't see what it is from just
scouring the manual and the language reference.

Thanks,

Adam Voigt
<email address removed>

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 16:29 (Fri, 4 Feb 2005 09:29:08 -0600)
From: Joseph J. Strout
At 10:18 AM -0500 2/4/05, Adam Voigt wrote:

>Hey, I'm getting started with a test project with Real Basic and I'm
>running into a problem generating controls on the fly.

That's because you can't do that.

What is your ultimate goal, that leads you to attempt such a thing?

Best,
- Joe

Re: Dynamic Generation of Controls
Date: 04.02.05 16:47 (Fri, 04 Feb 2005 10:47:15 -0500)
From: Adam Voigt
I have what is essentially a dynamic number of rows in a DB, each of
which need to be represented with a static text, and a edit control
(each on it's own row). Rather then having say, 20 of them, and only
making the ones I need visible (which seems fairly clunky), I wanted to
just have it generate the fields as I needed them.

Joseph J. Strout wrote:

> That's because you can't do that.
>
> What is your ultimate goal, that leads you to attempt such a thing?
>
> Best,
> - Joe
>

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 16:31 (Fri, 04 Feb 2005 10:31:57 -0500)
From: Jim Dossey
Lookup "Control Arrays" in the user's guide. You have to have at least
one control of the type you need in the window before you can
dynamically create more. I had to learn this the hard way too. You can
make the first control invisible if you don't want the users to see it.
If you create one StaticText object in your window called StaticText1,
then your code would look like this:

Dim blah As StaticText
blah = new StaticText1 // Notice this is StaticText1 not StaticText
blah.Top = 20
etc...

On Fri, 2005-02-04 at 10:18 -0500, Adam Voigt wrote:

> Hey, I'm getting started with a test project with Real Basic and I'm
> running into a problem generating controls on the fly. Here's what I have:
>
> Dim blah As StaticText
> blah = New StaticText
> blah.Top = 20
> blah.Left = 20
> blah.Text = "hi there"
> blah.Visible = TRUE
> Window1.Refresh()
>
> But the control doesn't appear. I'm very new at RB so I'm sure I'm just
> missing something simple, but I couldn't see what it is from just
> scouring the manual and the language reference.
>
> Thanks,
>
> Adam Voigt
> <email address removed>

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 16:48 (Fri, 04 Feb 2005 10:48:25 -0500)
From: Adam Voigt
That is precisely what my friend who does VB.NET suggested, but RB won't
let me do it, I created the initial control on the window called
StaticText1, but when I try to put it after the new, RB says it doesn't
recognize that class.

Jim Dossey wrote:

>Lookup "Control Arrays" in the user's guide. You have to have at least
>one control of the type you need in the window before you can
>dynamically create more. I had to learn this the hard way too. You can
>make the first control invisible if you don't want the users to see it.
>If you create one StaticText object in your window called StaticText1,
>then your code would look like this:
>
>Dim blah As StaticText
>blah = new StaticText1 // Notice this is StaticText1 not StaticText
>blah.Top = 20
>etc..
>
>_______________________________________________
>Unsubscribe or switch delivery mode:
><http://www.realsoftware.com/support/listmanager/>
>Search the archives of this list here:
><http://www.realsoftware.com/listarchives/lists.html>

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 16:53 (Fri, 04 Feb 2005 10:53:50 -0500)
From: Adam Voigt
Whooops, never mind, I accidentally didn't assign an Index to the first
control which was causing the class error. Working now, thanks for the help.

Jim Dossey wrote:

>Lookup "Control Arrays" in the user's guide. You have to have at least
>one control of the type you need in the window before you can
>dynamically create more. I had to learn this the hard way too. You can
>make the first control invisible if you don't want the users to see it.
>If you create one StaticText object in your window called StaticText1,
>then your code would look like this:
>
>Dim blah As StaticText
>blah = new StaticText1 // Notice this is StaticText1 not StaticText
>blah.Top = 20
>etc...
>
>On Fri, 2005-02-04 at 10:18 -0500, Adam Voigt wrote:
>
>>Hey, I'm getting started with a test project with Real Basic and I'm
>>running into a problem generating controls on the fly. Here's what I have:
>>
>>Dim blah As StaticText
>>blah = New StaticText
>>blah.Top = 20
>>blah.Left = 20
>>blah.Text = "hi there"
>>blah.Visible = TRUE
>>Window1.Refresh()
>>
>>But the control doesn't appear. I'm very new at RB so I'm sure I'm just
>>missing something simple, but I couldn't see what it is from just
>>scouring the manual and the language reference.
>>
>>Thanks,
>>
>>Adam Voigt
>><email address removed>
>>
>_______________________________________________
>Unsubscribe or switch delivery mode:
><http://www.realsoftware.com/support/listmanager/>
>Search the archives of this list here:
><http://www.realsoftware.com/listarchives/lists.html>

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 17:49 (Fri, 4 Feb 2005 08:49:39 -0800)
From: Phil M
On Feb 4, 2005, at 7:47 AM, Adam Voigt wrote:

> I have what is essentially a dynamic number of rows in a DB, each of
> which need to be represented with a static text, and a edit control
> (each on it's own row). Rather then having say, 20 of them, and only
> making the ones I need visible (which seems fairly clunky), I wanted
> to just have it generate the fields as I needed them.

Have you looked at the Listbox control? Listboxes are much more
commonly used in DB applications since the control provides practically
unlimited rows, and organizes the data nicely into columns.

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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 18:06 (Fri, 04 Feb 2005 12:06:29 -0500)
From: Adam Voigt
I completely agree for the typical presentation of flat data from a DB
the ListBox would be the way to go, but unfortunately in my case the way
the data needs to be shown from not only a functional but an asthetic
point of view, it pretty much has to be seperate controls which won't be
too bad since for now there won't be more then probably 15 rows.

Phil M wrote:

> Have you looked at the Listbox control? Listboxes are much more
> commonly used in DB applications since the control provides
> practically unlimited rows, and organizes the data nicely into columns.


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

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

Re: Dynamic Generation of Controls
Date: 04.02.05 17:59 (Fri, 04 Feb 2005 11:59:07 -0500)
From: Jim Dossey
I ran into that problem too. The problem I had is that the control that
I created was actually called StaticText11, instead of StaticText1.
Also make sure that the Index property of StaticText1 is set to 0
(zero).

On Fri, 2005-02-04 at 10:48 -0500, Adam Voigt wrote:

> That is precisely what my friend who does VB.NET suggested, but RB won't
> let me do it, I created the initial control on the window called
> StaticText1, but when I try to put it after the new, RB says it doesn't
> recognize that class.
>
> Jim Dossey wrote:
>
> >Lookup "Control Arrays" in the user's guide. You have to have at least
> >one control of the type you need in the window before you can
> >dynamically create more. I had to learn this the hard way too. You can
> >make the first control invisible if you don't want the users to see it.
> >If you create one StaticText object in your window called StaticText1,
> >then your code would look like this:
> >
> >Dim blah As StaticText
> >blah = new StaticText1 // Notice this is StaticText1 not StaticText
> >blah.Top = 20
> >etc..
> >
> >_______________________________________________
> >Unsubscribe or switch delivery mode:
> ><http://www.realsoftware.com/support/listmanager/>
> >
> >Search the archives of this list here:
> ><http://www.realsoftware.com/listarchives/lists.html>
> >
> >
> >
> >
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://www.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

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

Re: Dynamic Generation of Controls
Date: 04.02.05 17:59 (Fri, 04 Feb 2005 11:59:53 -0500)
From: Jim Dossey
Ok, I'm glad you got it working. I forgot to mention the part about the
Index.

On Fri, 2005-02-04 at 10:53 -0500, Adam Voigt wrote:

> Whooops, never mind, I accidentally didn't assign an Index to the first
> control which was causing the class error. Working now, thanks for the help.
>
> Jim Dossey wrote:
>
> >Lookup "Control Arrays" in the user's guide. You have to have at least
> >one control of the type you need in the window before you can
> >dynamically create more. I had to learn this the hard way too. You can
> >make the first control invisible if you don't want the users to see it.
> >If you create one StaticText object in your window called StaticText1,
> >then your code would look like this:
> >
> >Dim blah As StaticText
> >blah = new StaticText1 // Notice this is StaticText1 not StaticText
> >blah.Top = 20
> >etc...
> >
> >On Fri, 2005-02-04 at 10:18 -0500, Adam Voigt wrote:
> >
> >
> >
> >>Hey, I'm getting started with a test project with Real Basic and I'm
> >>running into a problem generating controls on the fly. Here's what I have:
> >>
> >>Dim blah As StaticText
> >>blah = New StaticText
> >>blah.Top = 20
> >>blah.Left = 20
> >>blah.Text = "hi there"
> >>blah.Visible = TRUE
> >>Window1.Refresh()
> >>
> >>But the control doesn't appear. I'm very new at RB so I'm sure I'm just
> >>missing something simple, but I couldn't see what it is from just
> >>scouring the manual and the language reference.
> >>
> >>Thanks,
> >>
> >>Adam Voigt
> >><email address removed>
> >>
> >>
> >
> >
> >_______________________________________________
> >Unsubscribe or switch delivery mode:
> ><http://www.realsoftware.com/support/listmanager/>
> >
> >Search the archives of this list here:
> ><http://www.realsoftware.com/listarchives/lists.html>
> >
> >
> >
> >
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://www.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

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