Go to Post ¡viva la weight réduction! - NoSkaOnTheRadio [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-11-2008, 13:22
kulverstukas kulverstukas is offline
Registered User
no team
 
Join Date: Nov 2008
Location: Kaunas
Posts: 1
kulverstukas is an unknown quantity at this point
Delphi ComboBox Items

Hello, im writing some app, and im stuck at ComboBox'es. The idea is, that when you click on a Item, that is in the ComboBox, the program must read the Text file, named by the Item name in the ComboBox, and output the content of the Text file in the MemoBox .
So, the question is, how to make the Item in the ComboBox display contents of Text file
Thanks
  #2   Spotlight this post!  
Unread 04-11-2008, 14:57
FourPenguins's Avatar
FourPenguins FourPenguins is offline
Back in the Game
AKA: Ed Venator
FRC #2399
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2005
Location: Mount Olive, NJ
Posts: 261
FourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud ofFourPenguins has much to be proud of
Re: Delphi ComboBox Items

Regrettably, you've stumbled on a forum that has nothing to do with Delphi programming. Someone here may still be able to help you though.
See http://www.chiefdelphi.com/forums/sh...ad.php?t=29944
__________________
MORT 11
-2005 New Jersey Regional Chairman's Award Winner
-2006 Palmetto Regional Winner
-2007 New York Regional Delphi Driving Tomorrow's Technology Award
-2008 New Jersey Regional Finalist, Chesapeake Regional Winner, Championship Event Overall Top Seed
HB 2399
-2009 Buckeye Regional Delphi Driving Tomorrow's Technology Award, Pittsburgh Regional GM Industrial Design Award
  #3   Spotlight this post!  
Unread 04-11-2008, 16:03
Tristan Lall's Avatar
Tristan Lall Tristan Lall is offline
Registered User
FRC #0188 (Woburn Robotics)
 
Join Date: Aug 2001
Rookie Year: 1999
Location: Toronto, ON
Posts: 2,484
Tristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond repute
Re: Delphi ComboBox Items

It's been a while since I've used Delphi...but if I remember correctly, you'll need to do the following:
  • Populate TComboBox.Items[] with a list of filenames stored as Strings. If I'm not mistaken, this is a dynamic Array of String. There's a method already provided that will let you add String variables: TComboBox.Items.Add(). Alternatively, if this doesn't have to be changed during program operation, just use the properties window to fill in Items yourself using the […] button.
  • When the user clicks something to confirm their selection, or hits enter, read the selected item from the TComboBox. Store that data (i.e. a filename) in a String.
  • Read the file's contents. Note that even if it's a .txt file, there are multiple ways of reading it in.
    • If you assign a variable of type TextFile (equivalent to type Text), it's sequential-access, and you'll need to parse it somehow. This depends on the input specification.
    • If you use type File (or File of [some type]), you'll probably get a mess. But you're stuck with it if you need random-access capability.
    Either way, you'll need to use AssignFile() with the file variable (of type TextFile, File or File of [some type]) and the filename (of type String). Also, you'll need to use Reset() and CloseFile().
  • If you want to put data into a TMemo, you might consider reading a TextFile line-by-line with ReadLn(), and then outputting the result to TMemo.Lines[] (dynamic Array of String).
Check the help file or http://www.delphibasics.co.uk for more information on the specific functions and types.

Incidentally, as was noted by FourPenguins, this forum is typically devoted to the FIRST Robotics Competition, and discussion of related topics.

Last edited by Tristan Lall : 04-11-2008 at 16:30. Reason: This is more like it…
Closed Thread


Thread Tools
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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Items Found at GLR Lindsey Regional Competitions 0 10-03-2007 19:25
FIRST items on ebay :-) Elgin Clock General Forum 15 13-12-2004 10:21
Collector's Items archiver 2000 0 23-06-2002 23:27
Delphi Automotive Systems is now just Delphi... Joe Johnson General Forum 10 21-03-2002 22:23


All times are GMT -5. The time now is 09:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi