Make group invisible after loosing focus - 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: heatherlaine, Klaus, FourthWorld, kevinmiller

Post Reply
DR White
Posts: 421
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Make group invisible after loosing focus - Solved

Post by DR White » Sat Oct 13, 2018 11:31 am

I have been struggling with this for a long time.

I have tried using "FocusOut" and numerous other work-arounds, but I have not found any that work with a group.

I am wanting my math calculator to become invisible, when a different object is touched in my mobile app.

Any help will be appreciated.

Thanks,

David
Last edited by DR White on Sat Oct 13, 2018 10:03 pm, edited 1 time in total.

SparkOut
Posts: 1810
Joined: Sun Sep 23, 2007 4:58 pm

Re: Make group invisible after loosing focus

Post by SparkOut » Sat Oct 13, 2018 2:33 pm

I am sure this cat can be skinned in many ways, but a top of the head thought (not tested, typed on my phone)

Code: Select all

on mouseMove
  if the mouseLoc is not within the rect of group "groupToHide" then
  --either hide it directly or
  send "hideTheGroup" to <the correct target> in 2 seconds
end mouseMove
You know what to put in the "hideTheGroup" handler

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

Re: Make group invisible after loosing focus

Post by jacque » Sat Oct 13, 2018 7:13 pm

Another way would be to use a mouseDown handler in the card script. On mouseDown, check the target and if the long name doesn't include the name of the calculator group, hide the group. Using mouseDown will still allow all existing mouseUp handlers to work and you wouldn't need to track the mouse position. If you already have mouseDown handlers in any control, you'd need to pass the message.

There are probably other ways to do this too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

DR White
Posts: 421
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Make group invisible after loosing focus

Post by DR White » Sat Oct 13, 2018 10:02 pm

I used :
on mouseDown pButtonNumber
set the vis of grp "Calculator" of card "CircuitHome" to false
end mouseDown

I thought that there was something about "focus" of the group that I could used,
but the above worked fine. I will just have to add some "pass" commands to some controls.

Thanks,

David

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

Re: Make group invisible after loosing focus - Solved

Post by jacque » Sat Oct 13, 2018 11:58 pm

I thought the focus commands worked that way too but the dictionary refers to keyboard access only.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Make group invisible after loosing focus - Solved

Post by jacque » Sun Oct 14, 2018 4:54 pm

If the calculator group has clickable buttons you'll probably need to put a blocking, empty mouseDown handler in the group too, since the card script handler doesn't check that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”