|
-
Jun 30th, 2014, 10:00 AM
#1
Thread Starter
Fanatic Member
Prevent Click Form Below (2 forms)
Hi
I have 2 forms (A and B), when I am using Forma A I call form B Modal , but when I did a double click in Form B It too click in button in form A . how to prevent click on the form below (A) ?
Tia
Last edited by mutley; Jun 30th, 2014 at 11:15 AM.
-
Jul 1st, 2014, 01:28 AM
#2
Re: Prevent Click Form Below (2 forms)
Should work:
Clicking a command button on Form1:
Code:
Private sub Command1_Click()
Form1.Enabled = False
Form2.Show
End Sub
Clicking a command button on Form2:
Code:
Private sub Command1_Click()
Form1.Enabled = True
Form2.Hide
End Sub
-
Jul 1st, 2014, 11:42 AM
#3
Thread Starter
Fanatic Member
Re: Prevent Click Form Below (2 forms)
me again
work fine when I tried to click in form1 when Form2 is actiive (It did to let), but when I clicked in control in Form2 , It too clicked in control in form1
-
Jul 1st, 2014, 11:46 AM
#4
Thread Starter
Fanatic Member
Re: Prevent Click Form Below (2 forms)
me again
work fine when I tried to click in form1 when Form2 is actiive (It did to let), but when I clicked in control in Form2 , It too clicked in control in form1
-
Jul 1st, 2014, 12:50 PM
#5
Re: Prevent Click Form Below (2 forms)
I have ran into this issue on handheld devices in the past where the top form unloaded and the click passed through to the bottom form which just happened to have a control at that position.
I did not go into it very far, my solution was to add a timer control to the form that would enable the form
So when second form is loaded set the enabled property to false on the first form then when second from is unloaded enabled the timer.
In the timer tick event enable the first form again. I generally use a timer interval of 100 for something like this which gives you 1/10th second delay between form2 closing and form1 being enabled which is enough time to prevent the click from passing through but not so much that the user notices the form being disabled when they return to it.
-
Jul 2nd, 2014, 09:40 AM
#6
Re: Prevent Click Form Below (2 forms)
 Originally Posted by DataMiser
my solution was to add a timer control to the form that would enable the form
a bit off-topic here, but i find myself doing the timer thingy as well, but to me its kind of unclean, bulky way, to approach to an issue.
Anyone got a different idea to efficiently execute a one-time delayed sub, without adding a timer to the form ?
(excluding the messy unstable Sleep and DoEvents technique).
-
Jul 2nd, 2014, 09:45 AM
#7
Re: Prevent Click Form Below (2 forms)
I agree it is a bit of a hack in this instance, I was in a rush to solve an issue when i came up with this method.
I have not however had this issue in any PC based programs, only a handheld app and it only happen in one spot there. The way the app was designed the Exit button was directly behind the button to return to the main menu and when a user touched the screen to return to the menu it would sometimes trigger the exit button and close the app which was a nuisance to say the least.
This really should not happen with a mouse click unless of course there is some issue with the mouse or you have a user like my wife who will click 3 or 4 times real quick.
That said using a timer to run a delayed piece of code is perfectly acceptable. Using 5 or 10 of them for this type of thing is not
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|