Page 1 of 1

Make group invisible after loosing focus - Solved

Posted: Sat Oct 13, 2018 11:31 am
by DR White
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

Re: Make group invisible after loosing focus

Posted: Sat Oct 13, 2018 2:33 pm
by SparkOut
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

Re: Make group invisible after loosing focus

Posted: Sat Oct 13, 2018 7:13 pm
by jacque
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.

Re: Make group invisible after loosing focus

Posted: Sat Oct 13, 2018 10:02 pm
by DR White
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

Re: Make group invisible after loosing focus - Solved

Posted: Sat Oct 13, 2018 11:58 pm
by jacque
I thought the focus commands worked that way too but the dictionary refers to keyboard access only.

Re: Make group invisible after loosing focus - Solved

Posted: Sun Oct 14, 2018 4:54 pm
by jacque
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.