show for a determinate time

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
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

show for a determinate time

Post by Samuele » Sun Jan 23, 2022 9:18 pm

Hi, is ther a way i can show something on my stack just for a determinate time for example "show for 2 seconds"?
I tried with wait, but it causes some problems in the speed and sometimes even freezes the stack.
Thanks!
Samuele.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: show for a determinate time

Post by stam » Sun Jan 23, 2022 9:51 pm

Write a handler that does the hiding, let’s say in card or stack script:

Code: Select all

On hideStuff
 # do hiding stuff

End hideStuff
On showing whatever needs to be hidden just call the hide handler at whatever time interval you want. E.g.

Code: Select all

On ShowStuff
## show status message or whatever 

## after showing stuff,  call the above handler:
 dispatch “hideStuff” to this card in 2 seconds // or whatever interval 
// assuming it’s in card script
End ShowStuff
Hope that helps…
Stam

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: show for a determinate time

Post by Samuele » Sun Jan 23, 2022 10:39 pm

this script gives me an error:

Code: Select all

on hideStuff 
   hide btn "ToBe"
end hideStuff


On ShowStuff
   show btn "ToBe"
   dispatch "hideStuff" to this card in 2 seconds
End ShowStuff
Samuele.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: show for a determinate time

Post by stam » Mon Jan 24, 2022 12:05 am

sorry - change 'dispatch' to 'send'

example attached
Attachments
showHIde.livecode.zip
(816 Bytes) Downloaded 119 times

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: show for a determinate time

Post by Samuele » Tue Jan 25, 2022 11:50 am

stam wrote:
Mon Jan 24, 2022 12:05 am
sorry - change 'dispatch' to 'send'

example attached
Thanks, that's exactly what in was looking for!
Samuele.

Post Reply