InputPanel strange problem

E

Enoque

Hello,

I got a problem with my application. I believe it doesn't happen
before.. something happened.

Every time I click on the icon to enable the InputPanel it changes my
Form.Text! It happens after I enable the InputPanel on two specific
forms. If the InputPanel is enable on the other forms.. it works just
fine, it doesn't change the text of the form (windows title). But if
it is enabled on that two specific forms the problem happens on all of
them.

I had one form and I needed a similar one so I copied the original and
pasted a copy on the solution. After that I performed some Quick Find
& Replace. These are the 2 forms I refer above that originate the
problem.

I already checked the code on both forms but can't find the problem.

Any ideas? Should I try to create a new Solution?

Regards,

Enoque
 
P

Paul G. Tobey [eMVP]

I have no idea what is going on, but I know that my own steps for finding out
would be to check the events list for the bad forms (which events they are
handling). Perhaps they are handling the activate/deactivate events or
something. If so, check the code for each event handling and see if it
matches the effect you are seeing. The same goes for any object in your
project that uses the input panel class in any way. Something the code is
doing is causing what you're seeing, I'm convinced. I don't think that
starting a new project will do anything for you, as long as you put that same
form in the project.

Paul T.
 
E

Enoque

I have no idea what is going on, but I know that my own steps for findingout
would be to check the events list for the bad forms (which events they are
handling).  Perhaps they are handling the activate/deactivate events or
something.  If so, check the code for each event handling and see if it
matches the effect you are seeing.  The same goes for any object in your
project that uses the input panel class in any way.  Something the codeis
doing is causing what you're seeing, I'm convinced.  I don't think that
starting a new project will do anything for you, as long as you put that same
form in the project.

Paul T.

Hello Paul,

Thank you for your reply! I created two break points on the project on
the event inputPanel_EnabledChanged on both forms! I open the 1st form
and it works fine, I close it, open the 2nd form enable the inputpanel
and it executes the code on the inputPanel_EnabledChanged and executes
after that the event inputPanel_EnabledChanged on the 1st form! The
windows text changes for the exact text the 1st form has but the first
form was closed before.. (form1.Close();) opening the 2nd form.

How is this possible if the events are private.. I guess it wouldn't
be possible to access from one form to a event of other.. at least a
private event..

I checked the forms.Designer.cs files but I don't see anything
wrong :S The generated code creates a event handler for each input
panel and they have different names.

Any idea?

Regards,

Enoque
 
P

Paul G. Tobey [eMVP]

Chances are, you somehow connected one form's event to a handler in the
other form. Without having it in front of me, I can't speculate further.

Paul T.

I have no idea what is going on, but I know that my own steps for finding
out
would be to check the events list for the bad forms (which events they are
handling). Perhaps they are handling the activate/deactivate events or
something. If so, check the code for each event handling and see if it
matches the effect you are seeing. The same goes for any object in your
project that uses the input panel class in any way. Something the code is
doing is causing what you're seeing, I'm convinced. I don't think that
starting a new project will do anything for you, as long as you put that
same
form in the project.

Paul T.

Hello Paul,

Thank you for your reply! I created two break points on the project on
the event inputPanel_EnabledChanged on both forms! I open the 1st form
and it works fine, I close it, open the 2nd form enable the inputpanel
and it executes the code on the inputPanel_EnabledChanged and executes
after that the event inputPanel_EnabledChanged on the 1st form! The
windows text changes for the exact text the 1st form has but the first
form was closed before.. (form1.Close();) opening the 2nd form.

How is this possible if the events are private.. I guess it wouldn't
be possible to access from one form to a event of other.. at least a
private event..

I checked the forms.Designer.cs files but I don't see anything
wrong :S The generated code creates a event handler for each input
panel and they have different names.

Any idea?

Regards,

Enoque
 
E

Enoque

Chances are, you somehow connected one form's event to a handler in the
other form.  Without having it in front of me, I can't speculate further.

Paul T.






Hello Paul,

Thank you for your reply! I created two break points on the project on
the event inputPanel_EnabledChanged on both forms! I open the 1st form
and it works fine, I close it, open the 2nd form enable the inputpanel
and it executes the code on the inputPanel_EnabledChanged and executes
after that the event inputPanel_EnabledChanged on the 1st form! The
windows text changes for the exact text the 1st form has but the first
form was closed before.. (form1.Close();) opening the 2nd form.

How is this possible if the events are private.. I guess it wouldn't
be possible to access from one form to a event of other.. at least a
private event..

I checked the forms.Designer.cs files but I don't see anything
wrong :S The generated code creates a event handler for each input
panel and they have different names.

Any idea?

Regards,

Enoque

Hello again Paul. Is it possible to send you my source code? I already
lost a lot of time and I couldn't find the source of the problem..

Thank you,

Enoque
 
P

Paul G. Tobey [eMVP]

Two months ago, I would have taken it, but my new job doesn't give me enough
time to dive into projects like that. As mentioned, it's likely to just be
an event assignment. In VS, you can look at the events assigned for all
event types supported by each form. You can also clear them. I'd be
inclined to clear them all for the input panels that you have (do you have
two input panels, by the way?), after writing down what they were, and then
add them back one at a time. Once you've found the one that causes the
problem, you can either figure out why it's a problem or show the code here
and someone can suggest what the problem is.

This type of thing often comes from assuming that because you have two
different names for the same object, they are actually different objects.
That is, you're confusing a reference to an object for the object itself.

name1 = new Object();
name1.event += eventHandler1;

name2 = name1; // it wouldn't need to be this obvious, but some form of
creating a new name for the same object
name2.event += eventHandler2;

Note that event will trigger both event handlers...

Paul T.
 
S

Simon Hart [MVP]

Try unsubscribing the EnabledChanged event in the Dispose method of both
forms - this way you are can ensure you have unsubscribed all uninterested
events.

Code such as: _sip.EnabledChanged -= OnEventChanged;

Should work.

--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com

I have no idea what is going on, but I know that my own steps for finding
out
would be to check the events list for the bad forms (which events they are
handling). Perhaps they are handling the activate/deactivate events or
something. If so, check the code for each event handling and see if it
matches the effect you are seeing. The same goes for any object in your
project that uses the input panel class in any way. Something the code is
doing is causing what you're seeing, I'm convinced. I don't think that
starting a new project will do anything for you, as long as you put that
same
form in the project.

Paul T.

Hello Paul,

Thank you for your reply! I created two break points on the project on
the event inputPanel_EnabledChanged on both forms! I open the 1st form
and it works fine, I close it, open the 2nd form enable the inputpanel
and it executes the code on the inputPanel_EnabledChanged and executes
after that the event inputPanel_EnabledChanged on the 1st form! The
windows text changes for the exact text the 1st form has but the first
form was closed before.. (form1.Close();) opening the 2nd form.

How is this possible if the events are private.. I guess it wouldn't
be possible to access from one form to a event of other.. at least a
private event..

I checked the forms.Designer.cs files but I don't see anything
wrong :S The generated code creates a event handler for each input
panel and they have different names.

Any idea?

Regards,

Enoque
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top