Some help with Delphi?

Barilak

Well-Known Member
Joined
Apr 18, 2012
Messages
256
Reaction score
0
Location
ZZ9 Plural Z Alpha
I need some help with a project I'm working on. I need to make an information kiosk program for a hypothetical game reserve. The kiosk will display a list of 24 different bird species, and when the user clicks on a bird, information about it will be displayed.

I have all the information about each bird stored in an Access database (with SpeciesNumber as the primary key.) When the user clicks on a bird, the program must select all the fields relating to the chosen bird from the database, and store each field as an attribute of a class.

I can't quite figure out how to do this. I've planned to have a variable (iSpeciesNumber), which would be stored with a specific number depending on which bird button was selected. Then I imagine I would need a query component:

"Select * from BirdsTbl where SpeciesNo = " + iSpeciesNumber

But then I'm not sure how to store the fields into attributes. Usually when I work with SQL in Delphi, I have a DBGrid component to display the queried fields - but now I need the fields to be stored directly into a class.

Any help would be greatly appreciated.
 
Last edited:
Retrieve the record (as a Dataset) using a TQuery component. Then move the Fields (of the Dataset) into the properties of the class.

e.g. Bird.Colour := QueryBird.FieldByName('Colour').AsString;
 
Retrieve the record (as a Dataset) using a TQuery component. Then move the Fields (of the Dataset) into the properties of the class.

e.g. Bird.Colour := QueryBird.FieldByName('Colour').AsString;

Thanks, I'll give that a try :)
 
It works like a charm!

Internet_High_Five-s520x376-156521.jpg


I'll be back if I have any more problems :)
 
I'm back :)

This one isn't really a problem per se. Does anyone know how to make a GUI designed in Delphi look better? My program is functioning properly, but it looks really "cheap." Any suggestions as to how I might make it look better? Or better yet, are there any plugins/add-on's that I can install that would enhance the GUI?

My program makes use of two forms. It would be nice if there could be some sort of transitional effect when the program switches between forms. The program displays information on panels. I would like these panels to look more professional - something in the vein of the Windows 8 Start interface.
 
what version of delphi are you using? the latest versions should have the office ribbon type controls, which help a bit

unfortunately, winforms by there nature of "boring", and doing transitions, etc is not the easiest thing to do, and your frm*.pas files start to get dirty with events, etc
 
I'm using Delphi 2010. I see that it does have some ribbon components. I'll look into them, thanks.

I would prefer not to over-complicate the code, so I'll stay away from transitions for now.
 
Top
Sign up to the MyBroadband newsletter
X