Solved

Combo box, (style = CsDropdownlist) show default value

Posted on 2000-02-17
8
1,725 Views
Last Modified: 2008-02-20
Hi,

I am using delphi 3.02

I have a combo box with a fixed known number of values (these are the ONLY valid values, so I have made the type CsDropDownList).

When I display the combo box I want a defuault value already shown, but currently it just shows blank until you select a value. I have tried code like combobox1.text := 'Default'; but still it initially shows a blank value. Is there anyway of overcoming this, or is this just the way the combo box of this type works?

Thanks
Clyde
0
Comment
Question by:clyde99
  • 4
  • 3
8 Comments
 

Author Comment

by:clyde99
ID: 2533592
Addendum:

The code combobox1.text := 'Default';
works for all other types of combo boxes, except the CsDropDownList and unfortunately this is the type of combo box I really want to use.
0
 
LVL 6

Expert Comment

by:edey
ID: 2533707
You can set the comboBox's itemIndex property in the parent form's OnCreate handler.

GL
Mike
0
 

Accepted Solution

by:
adpearce earned 50 total points
ID: 2533774
clyde,

Use the Combox's Items IndexOf property to select the index of the element you want.  Then just set the ItemIndex to the value returned:

ComboBox1.ItemIndex := ComboBox1.Items.IndexOf('default');

regards,
Ant.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 6

Expert Comment

by:edey
ID: 2535385
hmmmm....
0
 

Author Comment

by:clyde99
ID: 2539425
what is the hmmmm.... for edey ????
0
 
LVL 6

Expert Comment

by:edey
ID: 2540373
It is not generally cosidered polite to "rehash" someone else's comment as an answer


GL
Mike
0
 

Author Comment

by:clyde99
ID: 2540695
Mike,

Sorry. This is partly my fault. I considerd both answers to be correct, but when I looked at them adpearce was before yours, no I naturally assumed he had answered first and awarded the points.

My apologies, I should have had a closer look at the TIME.

Regards
Clyde
0
 
LVL 6

Expert Comment

by:edey
ID: 2540742
Hey no problem, the idea here is simply to lend a helping hand, perhaps to expect the same at a later date :)  Glad to here that you were able to find an acceptable solution :)

GL
Mike
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Correct Component for Shopping Cart. 2 112
Base1 Encode/Decode 3 82
Delphi and Access based Enumeration 9 70
How to Get Images From Server using App Tethering 11 40
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question