The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Delphi Programming
|
Array of ComboBoxes Delphi 7
Discuss Array of ComboBoxes Delphi 7 in the Delphi Programming forum on Dev Shed. Array of ComboBoxes Delphi 7 Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 4th, 2004, 12:52 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Location: Belfast, Northern Ireland, UK
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Array of ComboBoxes Delphi 7
Hi. I've searched quite hard on Google for the answer to my problem, with no avail. I'm hoping one of you code kids can help me.
My problem is that I'd like to create an array of Combo Boxes (ComboBox[0], ComboBox[1].. ComboBox[21]) for a program I'm writing. I had assumed that copying and pasting a combobox on the form would have presented me with the question "Do you want to create an array of this object?" or something. But it didn't. I seem to remember this happening for me before in some Visual language. I thought it was in Delphi, but perhaps not.
So my question is: is there any way of making this happen in Delphi 7, or is it simply not possible?
Thanks in advance.
|

March 4th, 2004, 12:50 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
I am not sure if the RAD GUI has this feature (I am using an older version). But creating an array of checkboxes is simple:
Code:
type TForm1=class
...
...
private
myCheckboxArray: array of TCheckBox;
...
end;
...
procedure TForm.OnCreate(Sender:TObject);
var i:Integer;
begin
SetLength(myCheckboxArray, 10);
for i:=0 to 10 do begin
myCheckBoxArray[i]=new TCheckBox(Self);
myCheckBoxArray[i].Parent:=Self;
myCheckBoxArray[i].Left:=10*i;
myCheckBoxArray[i].Top=100;
end;
end;
hth,
M.
|

March 4th, 2004, 03:03 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
You might want to tell us what you intend to use that array of checkboxes for. For example, if you want to assign them all to use the same event handler, there is a Delphi way to do the same thing.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|

March 4th, 2004, 11:14 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Location: Belfast, Northern Ireland, UK
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Thanks for your replies so far
I haven't tried M.Hirsch's suggestion yet, as I'm only just replying here. What I am attempting to do is to write a program that allows the creation and editing of a data file of drivers and teams for an offline GP4 league. So I need 22 combo boxes each from which I can select one of maybe 40 drivers. The drivers are looked up from a unique driver number, and other boxes should be filled with info (driver name, performance or grip values etc) from the combo box selection event.
I'm rusty with programming, and this is my attempt to get back on top of it.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|