change colour/background/border of button with image

1,557 views
Skip to first unread message

raluski

unread,
Jul 4, 2014, 9:47:03 AM7/4/14
to mitappinv...@googlegroups.com
In my app I want the user to be able to set a colour code on a button without changing the background image. Is any of these options possible?
1) Set a button border colour
2) Use a transparent image so the background colour is visible through.
3) use an image smaller than the button (tried this, it only stretches the image)
4) the only components I have found that can be stacked "in front of" each other are canvases and ImageSprites. Is this correct?  (So I can set the front component smaller than the back)

Any other sugestions?



-raluski

SteveJG

unread,
Jul 4, 2014, 9:56:52 AM7/4/14
to
Sounds good to me.

A neat feature of AI2 is that you can TRY anything.

Let us know when you have experimented with #1, 2, and 4, they all possibly work.
Regarding 3, I believe you are right.

You do know you have an image and text simultaneously  in a button?  The text can be any color you want.
You do know you can use a canvas with sprite images on it in lieu of a button?    Use the on touch event handler on the sprite to do the emulation.
You do know you can use an image that has text in any font you like and put it in a button to customize the button with fancy 'text'.

Why not write a simple app that demonstrates everything you try (tired).

Regards,
Steve

Regards,
Steve

raluski

unread,
Jul 4, 2014, 1:09:41 PM7/4/14
to mitappinv...@googlegroups.com
So:
I managed to make both an Image, Button and imageSprite transparent, using a .png image. .tiff is no good.
I had failed in this before because the .gif images I had used weren't transparent after all :-/

BUT:
A Button with a transparent image will show the BackgroundBolour of the Screen, and not that of the Button itself. Now we know. So this is not what I am trying to achieve.
I will have to use ImageSprites , and then I'll lose the LongClick function.





Taifun

unread,
Jul 4, 2014, 1:19:19 PM7/4/14
to mitappinv...@googlegroups.com
a button can only have a button background color OR a button background image, but not both the same time
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

SteveJG

unread,
Jul 4, 2014, 1:19:35 PM7/4/14
to mitappinv...@googlegroups.com
Nice exploring.

No reason to 'lose' the long click function ... use your imagination instead .     Use a Clock as a timer to delay execution of the touch by say 400 to 1000 ms.

raluski

unread,
Jul 4, 2014, 1:37:34 PM7/4/14
to mitappinv...@googlegroups.com
Thanks Taifun, I know that now :-)

raluski

unread,
Jul 4, 2014, 1:45:52 PM7/4/14
to mitappinv...@googlegroups.com
Thanks, I will have to look into that. Solving one problem opens many more...
Reply all
Reply to author
Forward
Message has been deleted
0 new messages