The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
NoMachine NX 3.2.0-1 (Web Builder branch) iBot Software Releases - RSS News 0 05-13-2008 08:10 PM
NoMachine NX 3.1.0-4 (Web Builder branch) iBot Software Releases - RSS News 0 03-10-2008 06:40 PM
NoMachine NX 3.1.0-3 (Web Builder branch) iBot Software Releases - RSS News 0 03-03-2008 05:10 PM
NoMachine NX 3.1.0-1 (Web Builder branch) iBot Software Releases - RSS News 0 01-15-2008 07:40 AM
C++/g++ builder for LINUX??? RohitThakkar High Level Programming 1 08-27-2005 09:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-01-2006
gefa gefa is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 72
C++ (Borland Builder) question

If anyone uses this can you help please;

I want to use a for loop to update several Objects without having to write them all into the script, e.g.,

If I have CheckBox1, CheckBox2, CheckBox3 etc I want loop round something like

for (int i=1;i<10;i++)
CheckBox(i)->State = 1;

Where CheckBox(i) would equal CheckBox1, CheckBox2 ...

How do I get the code to recognise that CheckBox(i) is in fact CheckBox1 etc

Any help or pointers would be appreciated
  #2 (permalink)  
Old 11-01-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,969
Note that Borland Builder is a Windows product, and this is a UNIX forum. We can answer language questions, but you're not likely to find answers for API specific things.

Also note that it's a very poor idea to declare variables inside a for loop like that. That does wildly different things on different compilers; sometimes it works, sometimes it causes compiler errors, sometimes it breaks things silently. Don't do it.

I'd make an array:
Code:
int i;
Object *checklist[]={checkbox1, checkbox2, checkbox3, checkbox4, NULL};

for(i=0; checklist[i] != NULL; i++)
  checklist[i]->State=1;

Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0