![]() |
Select a control by name
hi ;
I create some check box control in my form and i want to select it by its name (set focus control by it name ) . woul you please help me? abajan |
Re: Select a control by name
:
CheckBox1.SetFocus; |
Re: Select a control by name
Quote:
But I want select a group of check box in loop for example for i:=1 to 10 do {select controls by its name} abajan |
Re: Select a control by name
You have to create an array of pointers to TCheckBox, initialise that array so the first element points to CheckBox1, the second to CheckBox2, etc etc. Then you can loop over that array.
|
Re: Select a control by name
Do you mean you want to tick a group of checkboxes? This is different to setting the focus on a checkbox. The focus is the dotted border that shows which control is currently responding to keyboard input, and only one control can have it at a time. So a loop which sets the focus on a group of controls will effectively only set the focus on the last one.
To tick a checkbox, you can use :
CheckBox1.Checked = True;When you say by name, do you know the names at design time or runtime (as strings)? You can use Grumpy's method in the former case. |
| All times are GMT -5. The time now is 9:26 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC