Label of this stack - refreshing problem

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
3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

Label of this stack - refreshing problem

Post by 3d-swiss » Wed Apr 25, 2012 9:53 am

Hello again,

just a small problem, but it's irritating.

Code: Select all

# in the script of the stack: 
on preOpenCard
  set label of this stack to the short name of this card
end preOpenCard

# in the script of a card for a button:
on mouseUp
      lock screen
      go to card "Importieren"
      put empty into field "test"
      unlock screen      
      repeat with i = 1 to 1000
      # do a lot to stuff in here
      end repeat
end mouseUp
The field "test" is empty the moment the card "Importieren" is shown. But the lable will change not before the repeat loop is at it's and.
So during the hole process of importing the label is shown the name of the card before.

How can I force LiveCode to refresh the label before the loop will start?

Thanks for reading and for a tip.

Jens

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Label of this stack - refreshing problem

Post by shaosean » Wed Apr 25, 2012 11:02 am

Actually the label is updating, you just can't see it because of the tight loop (basically you are not allowing the engine to do anything else until it is done).. A good way to get around this is to either rewrite using send in time (medium-ish difficulty) or you could use wait with messages to allow your script to run and to allow the engine to do its job..

(looking at the issue again, I may have read it wrong, but the other suggestions still stand)

- get rid of the lock screen
- put empty into field "test" of card "Importieren"
- perhaps move your loop to the "Importieren" card

3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

Re: Label of this stack - refreshing problem

Post by 3d-swiss » Wed Apr 25, 2012 12:29 pm

thanks for your answer.

Now I created a brand new stack and a short version of my scripting. There is no delay with the label of the stack.

So, I have to search in my big project. Perhabs one 'lock screen' too much anywhere?

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

Re: Label of this stack - refreshing problem

Post by Klaus » Wed Apr 25, 2012 1:31 pm

Hi Jens,

some things:
1. According to the docs "label" only applies to BUTTONS!
It may work this way, but is not the OFFICIAL syntax!
You want to "set the TITLE of stack xyz to zxy"

2. The shown skript should work in any case, since the repeat loop is in a "MOUSEUP"
that will be executed at a time when "PREOPENSTACK" has already been finished!

Or am I missing something?


Best

Klaus

Post Reply