Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 4th, 2004, 12:52 AM
Setanta Setanta is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Belfast, Northern Ireland, UK
Posts: 2 Setanta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.
Comments on this post
JimmyGosling agrees!

Reply With Quote
  #2  
Old March 4th, 2004, 12:50 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,966 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 52 m 24 sec
Reputation Power: 189
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.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #3  
Old March 4th, 2004, 03:03 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,406 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 9 h 35 m 45 sec
Reputation Power: 4080
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

Reply With Quote
  #4  
Old March 4th, 2004, 11:14 PM
Setanta Setanta is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Belfast, Northern Ireland, UK
Posts: 2 Setanta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Array of ComboBoxes Delphi 7

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap