472,952 Members | 2,062 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

Form Not Respond To Mouse Click

I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?

Feb 22 '07 #1
5 2312
A mouse click is handled by a Control, not by the Form, unless there is no
Control in the location of the mouse click. If the Control does not have the
focus, the first mouse click will focus on the Control, and the second will
cause the Click event.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"moonie" <se************@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
>I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?

Feb 22 '07 #2
Thanks for your answer Kevin.
But I did not understand what should I do to fix the problem :)
I placed this.Refresh();this.Activate(); in the form code but it
did'nt help.
Also I should inform you that there are three panels on the form and
the labels, buttons etc. are on these panels.

On 22 Þubat, 15:55, "Kevin Spencer" <unclechut...@nothinks.comwrote:
A mouse click is handled by a Control, not by the Form, unless there is no
Control in the location of the mouse click. If the Control does not have the
focus, the first mouse click will focus on the Control, and the second will
cause the Click event.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"moonie" <serafettina...@gmail.comwrote in message

news:11**********************@q2g2000cwa.googlegro ups.com...
I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?- Alýntýyý gizle -

- Alýntýyý göster -

Feb 22 '07 #3
I found the solution :) I called Panel.Controls.Clear() method to
remove the labels and links. That is why the controls were not
disposed and their event handlers were not removed. So when I added
new controls with same event handlers somehow it got confused and the
click event did not work. Now I call Panel.Control[i].Dispose() for
every control on the panel and add new controls and it works great!

On 22 Åžubat, 16:21, "moonie" <serafettina...@gmail.comwrote:
Thanks for your answer Kevin.
But I did not understand what should I do to fix the problem :)
I placed this.Refresh();this.Activate(); in the form code but it
did'nt help.
Also I should inform you that there are three panels on the form and
the labels, buttons etc. are on these panels.

On 22 Þubat, 15:55, "Kevin Spencer" <unclechut...@nothinks.comwrote:
A mouse click is handled by a Control, not by the Form, unless there isno
Control in the location of the mouse click. If the Control does not have the
focus, the first mouse click will focus on the Control, and the second will
cause the Click event.
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com
I had the same problem once. Fixed it using the same solution.
"moonie" <serafettina...@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
>I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?- Alýntýyý gizle -
- Alýntýyý göster -- Alıntıyı gizle -

- Alıntıyı göster -

Feb 23 '07 #4
I found the solution :) I called Panel.Controls.Clear() method to
remove the labels and links. That is why the controls were not
disposed and their event handlers were not removed. So when I added
new controls with same event handlers somehow it got confused and the
click event did not work. Now I call Panel.Control[i].Dispose() for
every control on the panel and add new controls and it works great!

On 22 Åžubat, 16:21, "moonie" <serafettina...@gmail.comwrote:
Thanks for your answer Kevin.
But I did not understand what should I do to fix the problem :)
I placed this.Refresh();this.Activate(); in the form code but it
did'nt help.
Also I should inform you that there are three panels on the form and
the labels, buttons etc. are on these panels.

On 22 Þubat, 15:55, "Kevin Spencer" <unclechut...@nothinks.comwrote:
A mouse click is handled by a Control, not by the Form, unless there isno
Control in the location of the mouse click. If the Control does not have the
focus, the first mouse click will focus on the Control, and the second will
cause the Click event.
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com
I had the same problem once. Fixed it using the same solution.
"moonie" <serafettina...@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
>I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?- Alýntýyý gizle -
- Alýntýyý göster -- Alıntıyı gizle -

- Alıntıyı göster -

Feb 23 '07 #5
Good work, moonie. Yes, it is important to dispose of any Controls that are
added to another Control.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

I had the same problem once. Fixed it using the same solution.

"moonie" <se************@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
I found the solution :) I called Panel.Controls.Clear() method to
remove the labels and links. That is why the controls were not
disposed and their event handlers were not removed. So when I added
new controls with same event handlers somehow it got confused and the
click event did not work. Now I call Panel.Control[i].Dispose() for
every control on the panel and add new controls and it works great!

On 22 Subat, 16:21, "moonie" <serafettina...@gmail.comwrote:
Thanks for your answer Kevin.
But I did not understand what should I do to fix the problem :)
I placed this.Refresh();this.Activate(); in the form code but it
did'nt help.
Also I should inform you that there are three panels on the form and
the labels, buttons etc. are on these panels.

On 22 Þubat, 15:55, "Kevin Spencer" <unclechut...@nothinks.comwrote:
A mouse click is handled by a Control, not by the Form, unless there is
no
Control in the location of the mouse click. If the Control does not have
the
focus, the first mouse click will focus on the Control, and the second
will
cause the Click event.
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composerhttp://unclechutney.blogspot.com
I had the same problem once. Fixed it using the same solution.
"moonie" <serafettina...@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
>I have an msn style c# windows application with a form and panel on
it.
A news list is drawn from the database and dynamically added via
labels, link lables during form loading. In this application at run
time this list should be generated again as the filtering criteria
changes. So I clear the controls(labels) on the panel, get the list
from the database and generate the list again. The list is created
and
it works fine. But sometimes the form begins not to respond to mouse
clicks. Only mouse over and mousemove events work. Does anybody have
suggestions on why this happens?- Alýntýyý gizle -
- Alýntýyý göster -- Alintiyi gizle -

- Alintiyi göster -


Feb 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
8
by: Thomas W Ping | last post by:
Putting focus in a form element like a dropdown box and using the mouse wheel - even one click forward or backward with it - cycles through every record, in that direction, until first or last...
6
by: lauren quantrell | last post by:
I have a command button on a continuous subform and I want the user to click it to open a small popup form that opens in the position of the mouse (which is the same as the position of the command...
6
by: Nikki | last post by:
Hi, Can anybody help me in solving this problem. I m developing an application in which the main application form is borderless. now i m not able to move the application form with the help of...
1
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
0
by: moonie | last post by:
I have an msn style c# windows application with a form and panel on it. A news list is drawn from the database and dynamically added via labels, link lables during form loading. In this...
1
by: mflll | last post by:
I am having trouble responding writing a Javascript Program respond to keypresses on top of a paragraph. Here is the code I tried: <HTML> <SCRIPT Language="JavaScript">...
2
by: Joergen Bech | last post by:
Hope someone has a solution or some suggestions for this. This cannot be right?!? Problem: I have multiple non-modal forms open at the same time. One or more of these forms have a...
16
by: DavidGeorge | last post by:
I have an unbound form with three list boxes. The selections made in these list boxes 'filter' the records that appear in an unbound subform. The subform record source is a query which looks at...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.