I have the following challenge.
I made a popup field that removes itself after a few seconds without user intervention.
However, I also want to prevent the user from clicking on any of the buttons during the presentation of the popup field.
I thought to solve this by creating a graphical layer below the popup field but this does not block a user's click on a button below.
What solution can I use to prevent users to click on buttons during the presentation of the popup field?
Here is the test code I made.
//====================================================================================
// Show PopUp Message (by creating a temporary field and removing it)
//====================================================================================
command MessagePopUp tMessage, tShowTime, tBackgroundcolor, tTextColor
--- Checks ---
if tMessage = "" then put "No message!" into tMessage
if tShowTime = "" then put 3 into tShowTime
if tBackgroundcolor = "" then put "White" into tBackgroundcolor
if tTextColor = "" then put "White" into tTextColor
---
//lock screen
put "AutoPopUp" into tFieldName
if exists (field tFieldName) // Just to make sure it does not exist due to testing .
then
delete field tFieldName
end if
if exists (graphic tFieldName) // Just to make sure it does not exist due to testing .
then
delete graphic tFieldName
end if
----
create field tFieldName
create graphic tFieldName
set the visible of field tFieldName to false
---- Set Graphic criteria
set the rect of graphic tFieldName to the rect of this stack
set the opaque of graphic tFieldName to true
set blendLevel of graphic tFieldName to 50
set ink of graphic tFieldName to "blendSrcOver"
set the antialiased of graphic tFieldName to true
set the layer of graphic tFieldName to top
set the disabled of graphic tFieldName to true
---- Set Field criteria
put cr&tMessage&cr into field tFieldName
set the lockText of field tFieldName to true
set the opaque of field tFieldName to true
set borderwidth of field tFieldName to 2
set traversalon of field tFieldName to false
set showfocusborder of field tFieldName to true
set autotab of field tFieldName to false
set threeD of field tFieldName to true
set showborder of field tFieldName to true
set autohilite of field tFieldName to true
set listBehavior of field tFieldName to false
set multipleHilites of field tFieldName to false
set nonContiguousHilites of field tFieldName to false
set toggleHilites of field tFieldName to false
set the layer of field tFieldName to top
set the loc of field tFieldName to the loc of this card
set the backgroundColor of field tFieldName to tBackgroundcolor
set the foregroundColor of field tFieldName to tTextColor
//set textstyle of field tFieldName to "Bold" // Messesup the formattedWidth command
set the height of field tFieldName to the formattedHeight of field tFieldName
set the Width of field tFieldName to the formattedWidth of field tFieldName
-- Activate graphic and show field (PopUp)
//unlock screen
set the visible of graphic tFieldName to true
set the visible of field tFieldName to true
--
wait tShowTime seconds
set the visible of field tFieldName to false
--
delete field tFieldName
delete graphic tFieldName
--
end MessagePopUp
//====================================================================================
on mouseUp
if the vis of fld "ff" is false then
set the textColor of me to red
wait 3 seconds
set the textColor of me to blue
end if
end mouseUp
HOWEVER, I have a feeling that IF one clicks on a button during the time the field is visible
the mouseUp is somehow stored and activates after the field become invisible . . . not sure to be honest.
HOWEVER, I have a feeling that IF one clicks on a button during the time the field is visible
the mouseUp is somehow stored and activates after the field become invisible . . . not sure to be honest.
This is exactly the problem!
Does not matter if I use a Graphic or a Button. The MOUSE CLICK is stored and activated after the graphic and field are deleted.
PS. Thanks for the Tip Andy (changed code from stack to card. It now blocks the complete area).
Additional: I cannot block the complete message path because in the background I have a process running.
HOWEVER, I have a feeling that IF one clicks on a button during the time the field is visible
the mouseUp is somehow stored and activates after the field become invisible . . . not sure to be honest.
Erm . . . how about making all the buttons invisible while your field is visible?
This does work however I set it as below because only a MouseUp gave some strange results.
Also it does prevent the mouse from clicking however when i click at any place in the card (that is not an object) it activates the last clicked button .
If you don't want the user to click on the field either, then layer the graphic at the top of the card and set its blendlevel to 99. It will still catch and block mouse actions but will be virtually invisible to the user.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
mrcoollion wrote: Wed Mar 29, 2023 10:23 am
What solution can I use to prevent users to click on buttons during the presentation of the popup field?
[\quote]
Hi,
How about setting the cursor to none when the popup opens and resetting it to arrow when it closes?
Rob
Rob Cozens dba Serendipity Software Company
Manchester, CA USA
Each new generation gives more attention to the man-made world...
and less attention to the world that made man.
mrcoollion wrote: Wed Mar 29, 2023 10:23 am
What solution can I use to prevent users to click on buttons during the presentation of the popup field?
Hi Paul,
I'm afraid I'm rather sleep-deprived and haven't read the responses in depth. I can think of 2 approaches: one is the graphic element approach which think is already mentioned.
The other is that your popup field sits in a substack which you present as modal or sheet. This will block everything outside the substack until the substack is dismissed - not sure what feeds your needs best, but the modal substack approach may be simpler than coding a graphic to intercept mouse events...