Solved

Combo box, (style = CsDropdownlist) show default value

Posted on 2000-02-17
8
1,777 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

623 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