Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Highlight & Select Text

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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?

Avatar

23-06-2008

Yes that is the base of the funtionality. I would think this would be inserted on the click event.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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

Avatar

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?

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.