Can I stop the user from opening up multiple instances of a particular procedure such as a browse multiple times? I wish to do this because it may confuse the user if they see the same browse showing up several times.
There are "Thread Limiter" templates out there you could use one.
Here's a manual approach:
a) When you start the browse, disable the control(s) that are used to start the browse.
b) When the browse is about to return, have it it POST an event back to the window (typically the frame) that launched it. (note: you may have to pass in the calling thread, or use a some global variable to hold it) In 99.9% of applications you will find the Frame on thread 1. So POST(EVENT:USER + 42,,1) where the 42 part up to you.
c) Add logic to the calling window, when it receives the posted event, to re-enable the control(s) that are used to call the browse
Instead of disabling the controls, you could save the Thread of the browse. When the user ACCEPTs the control,
CASE ACCEPTED()
?BrowseCustomer
IF BrowseCustomer_Thread
POST(EVENT:USER + X,,BrowseCustomer_Thread)
!You might succeed with
!POST(EVENT:GainFocus,,BrowseCustomer_Thread)
ELSE
BrowseCustomer_Thread = START(BrowseCustomer)
END
!etc
CASE EVENT()
OF EVENT:USER + Y
BrowseCustomer_Thread = 0
!Note: this would probably be cleaner with a NOTIFY
On the BrowseCustomer side
CASE EVENT()
OF EVENT:USER + X
0{prop:Active}=TRUE
!etc.
Prior to returning
POST(EVENT:USER + Y,,1)
Again, it's up to you to select the + X part of the Event:User + X I strongly recommend that you use an Equate, as in EVENT:USER_GAINFOCUS EQUATE(EVENT:USER + 42)
Also FWIW, I recommend using EVENT:APP instead of
event:user
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.