advanced skinning

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kcwvc52
Posts: 49
Joined: Sun Jun 12, 2011 9:55 pm

advanced skinning

Post by kcwvc52 » Thu Sep 08, 2011 1:49 am

is there anyway to have a true custom shaped button. every time i skin a button it seems to keep the rectangle or square form (the invisible area still able to be clicked)? i want the button to be the shape of my object. if i can't do this with a button is there any other objects that can have true custom shapes from an image?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: advanced skinning

Post by bn » Thu Sep 08, 2011 7:45 am

Hi kcwvc52,

you could create a graphic with the freehand tool, freehand polygon tool or any other graphic and set its opaquen to true. turn border on or off. Then

Code: Select all

 set the backgroundpattern of grc 1 to  the id of image 1
the code for the "button" goes into the script of the graphic.

Is this the kind of effect you are looking for? Or else please explain object it is you want to turn into a button.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: advanced skinning

Post by jmburnod » Thu Sep 08, 2011 5:23 pm

Hi kcwvc52, Salut Bernd

I've made a little stack with what Bernd has explaned

I try have the same behavior of the btn (set the hilite to false when the mouseloc is not within the grc)
but the mouseup don't work well. Sometimes it work sometimes not (conflict with my mousedown script?)

BUT i'm sur Bernd have a solution 8)

Best regards

Jean-Marc
Attachments
skinBtn.rev.zip
(6.01 KiB) Downloaded 452 times
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: advanced skinning

Post by bn » Thu Sep 08, 2011 11:33 pm

Salut Jean-Marc,

nice stack.

To mimick the behaviour of a 'true' button I had to use a mouseMove handler and test for within. Found out that there is a difference between:

Code: Select all

point is within rect of me 
and

Code: Select all

within(me, point)
only the second one works for a non-rectangular clicking area, like in the irregularly shaped graphic you used.

And I did "close" the points of the graphic by putting the first line of the points behind the list of points. Otherwise the trigger area is not exactly within the shape of the graphic.

I attach a modified version of your stack, I think it does behave more like a regular button now: if the mouse is down and one moves the mouse outside of the trigger area the backgroundpattern changes to normal and back to clicked state if the mouse moves back into the trigger area.

Kind regards

Bernd
skinbtn2.livecode.zip
(6.12 KiB) Downloaded 446 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: advanced skinning

Post by jmburnod » Fri Sep 09, 2011 8:40 am

Guten Morgen Bernd,

Thanks again
It work well

Kind regards

Jean-Marc
https://alternatic.ch

Post Reply