First Click does Nothing

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
A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

First Click does Nothing

Post by A1Qicks » Sun Jan 17, 2016 4:36 pm

So, I've got a section off to the left of my card that I want to slide out in front. It should be hidden by default. This is what I have:

local showOnline

on OpenCard
set the right of group OnlineUsers to the left of this card
put false into showOnline
end OpenCard

on mouseUp
if showOnline is false then
move group OnlineUsers to 96, 332 in 80 milliseconds
put true into showOnline
else
move group OnlineUsers to -96, 332 in 80 milliseconds
put false into showOnline
end if
end mouseUp

This works absolutely fine, apart from the fact that after opening the card, the first click does nothing. After that, it works as it should. Why is this?

hpsh
Posts: 52
Joined: Tue Aug 25, 2015 8:06 pm

Re: First Click does Nothing

Post by hpsh » Sun Jan 17, 2016 6:46 pm

think you need to change local showOnline to Global showonline

also you need to include that in the button script

also:
--cardscript

Code: Select all

global showOnline

on OpenCard
set the right of group OnlineUsers to the left of this card
put false into showOnline
end OpenCard
--button script

Code: Select all

on mouseUp
global showonline
if showOnline is false then
move group OnlineUsers to 96, 332 in 80 milliseconds
put true into showOnline
else
move group OnlineUsers to -96, 332 in 80 milliseconds
put false into showOnline
end if
end mouseUp

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: First Click does Nothing

Post by A1Qicks » Mon Jan 18, 2016 2:16 pm

Fixed it - thanks!

Post Reply