Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I prevent user calling the same procedure multiple times? 1

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone,

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.

Thanks.

Emad
 
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

HTH,
Mark
 
I had another idea.

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

Event:APP EQUATE(08000h)
Event:APP_LAST EQUATE(0BFFFh)

The link below tells you why....

 
Hi Mark,

Thanks for the usefull reply.

I will experiment with your suggestions.

Truly,

Emad-ud-deen Richard Leiman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top