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!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Wed Feb 26, 2014 11:12 pm
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:
Code: Select all
set the backgroundimage of me to [ImageName]
Regards,
croivo
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
-
Contact:
Post
by FourthWorld » Wed Feb 26, 2014 11:19 pm
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.
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Wed Feb 26, 2014 11:35 pm
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):
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Sat Apr 12, 2014 7:28 pm
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?
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
-
Contact:
Post
by FourthWorld » Sat Apr 12, 2014 7:48 pm
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
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Sat Apr 12, 2014 7:56 pm
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)?
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sat Apr 12, 2014 8:03 pm
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
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Sat Apr 12, 2014 11:39 pm
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.
That is exactly what I wanted. Thanks!