Page 1 of 1

Label of this stack - refreshing problem

Posted: Wed Apr 25, 2012 9:53 am
by 3d-swiss
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

Re: Label of this stack - refreshing problem

Posted: Wed Apr 25, 2012 11:02 am
by shaosean
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

Re: Label of this stack - refreshing problem

Posted: Wed Apr 25, 2012 12:29 pm
by 3d-swiss
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?

Re: Label of this stack - refreshing problem

Posted: Wed Apr 25, 2012 1:31 pm
by Klaus
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