reload buttons via script?

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
Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 2:18 pm

Hi,

got a (hopefully) simple question:

I got a skinned button. The icons are imported on a substack. But if I exchange the IDs of the imported images (on the substack) - the icon of the buttons in the current stack wont change inmedently - first I have to hover above the buttons.

Is there a way to "reload" the buttons, so they change their skin? Or maybe is there a message I could send to the buttons?

Thanks alot

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 2:32 pm

Hi Tomka,

you could try:
...
lock screen
## do your skinning stuff
## ...
unlock screen
...
That should work.


Best

Klaus

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 2:41 pm

I'm sad because it doesnt...

The button is shown with the old skin-image until I hover with mouse over it.

Maybe I should reload the whole stack but it will makes it a bit more difficult :)

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 3:01 pm

Hi Tomka,

hm... damn!
OK, reloading the stack is also not the solution.

I presume you are just setting the icons to the new image ids right?
Sorry, no idea so far...


Best

Klaus

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 3:09 pm

Hi,

I dont change anything on the button-proporties. I exchange the IDs of the 2 imported images :)

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 3:17 pm

Hä???
How do you exspect the button to know about that fact? 8)

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 3:26 pm

Ok let me explain :)

For example "button 1": the setting for icon=1007 (property-inspector). The image1 with ID 1007 is an image imported as control on a substack.

If the user changes the language of the program the script will change ID of those image1 to <xyz> (any unused ID) and then the ID of the second image2 to 1007.

If the user changes the language again the script will set the ID of image1 back to 1007 :)


It really works good but the great problem is that the user have first to mouseover the buttons to see the new skin.

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 3:45 pm

AHA! :D

But I have still no idea how to solve this problem.

Any chance that you do NOT change the image IDs, which is an erm... rather unusual approach 8)
but only set the icons of your buttons? I am sure that will work fine.


Best

Klaus

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

Re: reload buttons via script?

Post by bn » Thu Jun 16, 2011 3:46 pm

Hi Tomka,

you could try to:

Code: Select all

 set the hilite of btn "b1" to not the hilite of btn "b1"
   set the hilite of btn "b1" to not the hilite of btn "b1"
do it twice to restore the hilite before the command.

It seems to work

Kind regards

Bernd

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 4:08 pm

@Klaus:

It would makes it more difficult because I also use a substack which is not loaded when the user can change the language. So I dont need to add anything in its preopenstack-script. Its all done with the script in the 2 buttons.

@Bernd:

It works great! Thats what I was looking for. Great thx!

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 4:45 pm

Hi Jungs,

aha, wieder was gelernt :D


Best

Klaus

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

Re: reload buttons via script?

Post by bn » Thu Jun 16, 2011 4:52 pm

Tomka,

it wasn't after Klaus asked for what exactly it was you wanted that I understood what you were trying to do. It might help to explain a little what you want to do in the first place :)

Kind regards

Bernd

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

Re: reload buttons via script?

Post by Klaus » Thu Jun 16, 2011 4:56 pm

bn wrote:... It might help to explain a little what you want to do in the first place :)
Das ist hier im Forum aber eigentlich nicht üblich! :D

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: reload buttons via script?

Post by Tomka » Thu Jun 16, 2011 5:42 pm

Next time ill try to explain better :) ...

Post Reply