Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Let's say my button has background image [picture1] and what I want to do is when I click on that button, the background image changes from [picture1] to [picture2]. How to change image background? The code should be something like:
If you use the button's icon properties this becomes very easy with automatic behavior - check out the Dictionary filtered for "icon" to see all the icon options available.
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
FourthWorld wrote:If you use the button's icon properties this becomes very easy with automatic behavior - check out the Dictionary filtered for "icon" to see all the icon options available.
Thanks
Here is my code now (if somebody wants to know):
Hello guys, I have question about how to change the background of text field when it is selected (active). I want to have, for example, green text fied but when user click with mouse on it (or with TAB key navigates to that field), it become blue. And when user click on some other field or on empty area, the background changes back to green.
Any ideas?
While only buttons have an icon property, all controls in LiveCode have many other properties to govern appearance, including foregroundColor, backgroundColor, foregroundPattern, and backgroundPattern.
The latter is what you're looking for here:
set the backgroundPattern of field "SomeField" to tSomeImageID
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
FourthWorld wrote:While only buttons have an icon property, all controls in LiveCode have many other properties to govern appearance, including foregroundColor, backgroundColor, foregroundPattern, and backgroundPattern.
The latter is what you're looking for here:
set the backgroundPattern of field "SomeField" to tSomeImageID
I know for that, my problem is that I don't know what code to put instead of "on mouseUp" (i don't know how that line of code i called). How to know when text field is selected (active)?
See the "focusIn" and "focusOut" entries in the dictionary. Or, depending on what your script does, you might use "openfield" and "closefield" and "exitField" instead.
Edit: I see that your field is editable. In that case use the open/close/exit field messages. Focus messages only work in locked fields.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque wrote:See the "focusIn" and "focusOut" entries in the dictionary. Or, depending on what your script does, you might use "openfield" and "closefield" and "exitField" instead.
Edit: I see that your field is editable. In that case use the open/close/exit field messages. Focus messages only work in locked fields.