Force a redraw or refresh of the screen...[Solved]

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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Force a redraw or refresh of the screen...[Solved]

Post by bogs » Sun Mar 03, 2019 3:02 pm

LOL

What did they change the magic incantation to to use the alignment buttons on the bottom of the project browser ?
Workspace 1_001.png
What the...
This is a Win7 vm

First I selected the 3 fields on the card, opened the PB, then tried to align tops (which sorta worked), then went to the <-----> arrow icon to put them side to side and ....nothing. I reselected the controls in the PB itself and tried agin ... nothing, not even a menu.

Then I selected the big field and the left most small one on the card, and hit align lefts icon.... all the small fields aligned to the left !

What am I missing?

*Edit - Win 7 vm shows none of the behaviors seen on the linux box, everything moves very smoothly and keeps in sync extremely well.
Image

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Force a redraw or refresh of the screen...[Solved]

Post by ValiantCuriosity » Mon Mar 04, 2019 9:19 pm

Maybe this is off topic for this post, but the title does describe something that is driving me slightly more crazy than usual. That is, How do I reload/refresh a card?

So...
I have one stack and its card. I want to be able to reload or refresh the card when I click a button.

I've tried:

Code: Select all

onMouseUp
  open card "cMyCard"
endMouseUp
also tried:

Code: Select all

onMouseUp
  go card "cMyCard"
endMouseUp
Since I'm already on the card, it doesn't refresh or reload the card. Is there an "easy" way to do this. This thread and the solution is pretty convoluted and doesn't really apply to what I'm after. I'm thinking there must be some way to do this. Most other languages have it using a command of some sort.

TIA
-Rachel
May I never be cured of my curiosity! :D

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by Klaus » Mon Mar 04, 2019 9:48 pm

Question is:
What does not redraw/reload automatically on your card, so this action is necessary?
In other words: What the egg are you doing? :D

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Force a redraw or refresh of the screen...[Solved]

Post by ValiantCuriosity » Tue Mar 05, 2019 12:51 am

Well,
For now, I just want the card to refresh whenever I select the "Browse Tool" and run the script.

I've looked at the "Send" message. I wonder if that works? It seems to, but I can't really tell because the code could just be skipping over it.

Code: Select all

on mouseUp pButtonNumber
   -- code
   send "openCard" to this card
   set the backgroundColor of this card to "blue"
end mouseUp
Then I use the same code in the message box and change the card color to white.

As it stands now, the only way to get the entire stack or the first stack card to refresh is to close the app and reload it. Is that expected behavior in LC? What am I missing here?

-Rachel
May I never be cured of my curiosity! :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by jacque » Tue Mar 05, 2019 5:53 pm

The mouseUp handler should work fine. And unless you have or need an opencard handler you can omit that. Also, since messages will go from the button to the card, you should be able to just use "opencard" without the "send".

Code: Select all

 on mouseUp pButtonNumber
   -- code
   openCard
   set the backgroundColor of this card to "blue"
end mouseUp
We really do need a refresh command but the workaround for now is:

Code: Select all

set the backgroundColor of this card to the background color of this card 
Unless of course you want to change the color as above.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Force a redraw or refresh of the screen...[Solved]

Post by ValiantCuriosity » Tue Mar 05, 2019 7:14 pm

Thanks @Jackie. This is really bothering me.

I don't want to use a button to refresh, but I can do that. I'm really just testing and learning. I want the whole card to reload when I press the browse button in LC.

As an example, this AM I was grappling with text styling (thank you bogs and hh). One Stack. One Card.
This is in a field:

Code: Select all

set the textStyle of line 2 of field "Field" to "italic,underline"
When I run the code and change it slightly to "bold", then use browse, the field doesn't refresh. The only way that I can see to do that is to use the button. I've tried putting the code in the card and that doesn't work.

TIA
-Rachel (The good news is that the styling text is working) :D
May I never be cured of my curiosity! :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by jacque » Tue Mar 05, 2019 7:40 pm

Right, the IDE tries to stay out of your way, so you need to provide your own trigger. It can be anything you want, a button press, an exitfield or closefield message, any message the LC engine sends. Or you can create a handler and call it from the message box.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by Klaus » Tue Mar 05, 2019 8:01 pm

Hi Rachel,

what Jaqueline said, use the MESSAGE BOX, this is our "command line" in LC!
Very helpful for things that you do not want to put into buttons or wahtever.


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by jacque » Tue Mar 05, 2019 9:49 pm

For one-off things and short script snippets, I don't even create handlers. I just do them directly from the message box. That's easier than remembering to remove a temporary handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Force a redraw or refresh of the screen...[Solved]

Post by ValiantCuriosity » Wed Mar 06, 2019 12:03 am

Opps! Jacque,

Apologies for misspelling your name! I have a friend that spells it "Jackie" so I forgot. :?

Thanks to you and to Klaus ,as always, for stepping up to clarify. The commands are what I need to look at. I'll keep working. :lol:

-Rachel
May I never be cured of my curiosity! :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Force a redraw or refresh of the screen...[Solved]

Post by jacque » Wed Mar 06, 2019 5:57 pm

No apology needed, no one knows how to say or spell my name. :) You did get the pronunciation right though.
http://jacque.on-rev.com/jacque/jacque.irev
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bbalmerTotalFluency
Posts: 52
Joined: Mon Apr 06, 2020 1:19 pm
Location: Thailand
Contact:

Re: Force a redraw or refresh of the screen...

Post by bbalmerTotalFluency » Wed Feb 21, 2024 8:03 am

This didn't work for me UNLESS I put that command in a named command in my stack. Even then it doesn't work if I call that named command directly. It DOES work if I send "namedCommand" to this stack in 10 milliseconds.

I don't know if the delay is necessary or not. It's working for me as it stands.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”