Trying to get id of label field?

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

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Trying to get id of label field?

Post by jalz » Tue Jun 25, 2013 2:30 pm

Hi Guys,

I've created a couple of icons using the label control. I basically dragged the label control, made sure it was opaque, filled the background in to a specific colour, changed text colour and line spacing so the 'icon' looked exactly the way I wanted it. I then duplicated that control, changed the background colour slightly, as I wanted to use it as a hover over on a button.

The problem is trying to attach those two controls to my button. I've inserted a blank button, but I can't change the icons for hover over etc to the ones from the label field as they don't have ID numbers on them. Is there anyway I can get the id numbers of the static controls I have created?

Many thanks
jalz

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Trying to get id of label field?

Post by Klaus » Tue Jun 25, 2013 2:35 pm

Hi jalz,

let me see if I really get it... 8-)

1. You created some FIELDS (labels are fields) and modified them until they look OK for you.
2. You want to use them (the way they look) as ICONS in buttons.
Is that correct so far?

Well, you cannot do this directly, since ICONS in buttons need to be IMAGES!
You could "import snapshot..." to create IMAGES from your different fields
and use them in your buttons.


Best

Klaus

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Trying to get id of label field?

Post by jalz » Tue Jun 25, 2013 3:24 pm

Thanks Klaus,

I think I will recreate them as images and import them. Thought there might be a way of converting the label field into an image/icon/sprite directly from within livecode.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Trying to get id of label field?

Post by Klaus » Tue Jun 25, 2013 3:34 pm

Hi jalz,
jalz wrote:Thanks Klaus,

I think I will recreate them as images and import them. Thought there might be a way of converting the label field into an image/icon/sprite directly from within livecode.
yes, you can "import snapshot..." in Livecode to "turn" your fields into images!
No other way, sorry.


Best

Klaus

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: Trying to get id of label field?

Post by dave_probertGA6e24 » Tue Jun 25, 2013 6:07 pm

Jalz,

Just to be clear - the "import snapshot ..." is a Livecode programming code statement (look it up in the Livecode Dictionary).

Klaus doesn't mean that you can only create snapshot images Outside of Livecode and Import them (even though the command sounds like that!) Although creating the images outside of Livecode is perfectly acceptable as well. :)

Hope that helps,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Trying to get id of label field?

Post by mwieder » Tue Jun 25, 2013 7:50 pm

There's another way out of this as well:

Set the script of the hover label to

Code: Select all

on mouseLeave
  lock screen
  hide me
  show field "NormalButton"
  unlock screen
end mouseLeave

on mouseUp
  -- do your normal mouseUp stuff here in the hover button
end mouseUp
Set the script of the normal label to

Code: Select all

on mouseEnter
  lock screen
  hide me
  show field "HoverButton"
  unlock screen
end mouseEnter
Set the loc of both labels to the same thing
Hide the hover label

Now when you move the cursor of the displayed label the hover label will appear and when you move the mouse off it the normal label will appear. No button needed.

Post Reply