Topic: ComboBox first empty Item...

Is it possible to add a custom text on ComboBox first empty Item?

Adam
God... please help me become the person my dog thinks I am.

Re: ComboBox first empty Item...

Hi Adam,
Is this so it's like some sort of hint for the user?
Derek

Re: ComboBox first empty Item...

I don't know about changing default value but i tried this and it worked for me form1.combobox1.itemindex := 1  hope it helps

AD1408 wrote:

Is it possible to add a custom text on ComboBox first empty Item?

Re: ComboBox first empty Item...

Thanks a lot guys....

derek wrote:

Hi Adam,
Is this so it's like some sort of hint for the user?
Derek

Yes Derek, instead of showing blank or no space, having text line something like "Please select one"

Adam
God... please help me become the person my dog thinks I am.

5 (edited by derek 2017-05-21 15:57:28)

Re: ComboBox first empty Item...

Hi Adam,
Yes, I thought it was probably for that reason.
Please have a look at the attached (specifically the combobox on form2).
1.  I actually set 'combobox first item empty' to be false in the object properties (sounds stupid, right!! - LOL) and also set the 'sorted' object property.
2.  I then have an entry in the combobox list that is the 'help' that you want to display. 
3.  Enter the 'help' with a leading space or asterisks or something like that and it forces it to the top of the combobox list and so looks like a 'help' message.
4.  Add a small script to test (on 'save') whether the user has tried to use the 'help' message as a valid selection.
Alternatively, just use a text hint - not quite the same effect but much quicker!
Regards,
Derek.

Post's attachments

Attachment icon Copy of sm2 with counts in the buttons.zip 351.05 kb, 391 downloads since 2017-05-21 

Re: ComboBox first empty Item...

Hello AD1408, Derek

For your request, you have also this option :

   Form1.ComboBox1.TextHint := 'Please select one';
   Form1.ComboBox1.Style := csDropDown;

JB

Re: ComboBox first empty Item...

Hello Jean,
Thanks, I know about 'form1.combobox1.texthint' but I think this is something that only works with later versions of Windows (Vista and above?).
Some of the users I write stuff for still use XP!
Derek.

Re: ComboBox first empty Item...

Hi Derek,
Nice one...  Truly appreciated..........
Adding a message for selecting actual item is very thoughtful of you.


Hi JB,
Thanks for the info.............

Adam
God... please help me become the person my dog thinks I am.