Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Dec 18, 2017 1:44 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Enabling groupboxes via loop
PostPosted: Tue Feb 26, 2013 1:10 pm 
Offline

Joined: Wed Oct 31, 2012 11:21 pm
Posts: 12
Hi all,

Short question, im trying to enabled selected groupboxes, using loop, since although if else statements would work, it would be alot.

at the moment, we have groupboxes : select1, select2 select3 etc etc etc..

so, depending on users choice, it should enable 1-21 selections.

the issue, i cant enable the groupbox that way....

tried this simple code

dim i as Integer
i = 1
select"+val(i)+".visible = true

just to enabled the 1st groupbox, select1, and this doesnt fire at all. error actually....

is there a way for this? or am i complete wrong to think it would work in a loop?

appreciate any feedback, and thanks.


Top
 Profile  
Reply with quote  
 Post subject: Re: Enabling groupboxes via loop
PostPosted: Tue Feb 26, 2013 1:39 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
You can't use select"+val(i)+".visible = true, but you can use a Control Array.

A control array is an array of controls (groupboxes, buttons, etc.) that all have the same name but who each have a different Index number (the first control is Index 0, then 1, 2, 3, etc.) The Index number property is directly beneath the Name property in every control's property list in the window designer. Here's a screencap of what I mean:
Image
The index of the selected control is 0.


You can use a loop to interact with the controls in a control array provided you know in advance how many controls are in the array:

For i As Integer = 0 To 4 ' assuming 5 GroupBox controls in the array
SelectBox(i).Enabled = True
Next


For an example of using a control array, see: http://docs.realsoftware.com/index.php/ ... On_The_Fly

_________________
Boredom Software


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group