Highlighted

Highlight & Select Text

Avatar

Guest

23-06-2008

I would like to be able to highlight and select the default text that I have entered in a listbox.



The idea is to have instructions inside the listbox, the user clicks in the listbox, the text gets highlight and selected and then the user begins to enter the correct values inside the listbox.



I came across the following:



TextField1.fillColor = "150,130,33";



but I am unable to get this to work.



Has anyone done this before?

Replies

Highlighted

pguerett

23-06-2008

So I open the list box and there is one item (the instructions). I choose that and overwrite it with a new entry?
Highlighted

pguerett

23-06-2008

I don't think you will be able to do what you want. There is no means to add an entry to a list box by typing. You can add an entry to a dropdown but not a listbox. Also you cannot replace an entry that exists. You would have to remove it then add your new entry.
Highlighted

pguerett

24-06-2008

You could add code that will clear out th efield when you enter it. On the Enter event add this code:



this.rawValue = "";



Note that if the user goes back to this field later it will be blanked out. So you could check to see if the field contains test that was intended as instructions. Something like this"



if (this.rawValue == "instructions"){

this.rawValue = "";

}



Hope that helps
Highlighted

Avatar

Guest

24-06-2008

Is there something similiar you can do to a list box?



Perhaps add one item on load and then when populated after adding items to the list?
Highlighted

pguerett

25-06-2008

You cannot type into a list box to add an item. You can enter your info into a different field then programmatically add to the listbox by using the addItem method.
Highlighted

pguerett

25-06-2008

You can type into a drop down list if you want to do that instead. There is a check box in the object palette that allows you to add an entry.