Topic: Combobox with default value pre-selected

I have a special request for you smile

I am looking for a way to display a name in a combo box so everyone knows what this combo box contains instead of adding a text beside like for a button.

For example:

In the attached screenshot, I would like to display the name of the comboxbox inside the combo by default and then, when a choice is made, it should display the chosen value.

if no value chosen then display: IMG

IMG list = 203.1
                202.2
                204.0

if IMG value 203.1 chosen, then display: 203.1


I would be great if we could do the same in the textbox component!

if no value in textbox, then display textbox name
if value in textbox, keep this value tongue

Post's attachments

Attachment icon project-connect.jpg 26.76 kb, 341 downloads since 2015-01-26 

Re: Combobox with default value pre-selected

You can do it using script

// for ComboBox
    Form1.ComboBox1.TextHint := 'Status';
    Form1.ComboBox1.Style := csDropDown;


// for TextBox
    Form1.Edit1.TextHint := 'Last name';
Dmitry.

3 (edited by tcoton 2015-08-31 13:48:37)

Re: Combobox with default value pre-selected

Fantastic, it looks much more professional now with these text hints!!

Thanks Dmitriy!!

Re: Combobox with default value pre-selected

Прошу прощения, не в тот языковой форум, но просто продолжения этого же компонета, а как можно пустое поле назвать которое в выпадающем списке есть назвать например "Все"?

Re: Combobox with default value pre-selected

Do you mean that you want to replace the white space before the values in a combo by the text "All" ? That would be a great idea!

Re: Combobox with default value pre-selected

yanikmi

procedure Form1_OnShow (Sender: string; Action: string);
begin
   Form1.ComboBox1.Items[0] := 'All';
end;
Dmitry.