Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / March 2008

Tip: Looking for answers? Try searching our database.

Something eats next click after click on ToolStripButton

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Below - 07 Mar 2008 06:22 GMT
I have a form that is brought up within an MFC app that is compiled with
/clr.  The form has a method that can be executed either by a menu item or a
toolstrip button.  The method invokes an ActiveX control.  If I click on the
menu, it works as expected.  If I click on the button, the ActiveX control
brings up a modal dialog as expected but the first click on the dialog has no
effect.  It is not seen by the control.  The second click works as expected.  
It turns out that it doesn't make any difference where in the app the first
click occurs -- something eats the first click.

Any ideas?

Thanks
Bill
Linda Liu - 07 Mar 2008 08:57 GMT
Hi Bill,

Based on my understanding, you have a form which contains a MenuStrip and a
ToolStrip and a method. Clicking one menu item in the MenuStip or one button
in the ToolStrip will execute this method.

From this method, you open a modal dialog. When you click the menu item, all
works well, i.e. the modal dialog appears and gets the focus.

When you click the ToolStrip button, the modal dialog appears but the
problem is that the dialog doesn't get the focus. Even if you click the
dialog, it doesn't get the focus. If I'm off base, please feel free to let
me know.

I perform a test by creating a Windows Application project in C#, but don't
reproduce the problem in my test. I show the dialog by calling the
Form.ShowDialog method. The modal dialog appears and always gets focused
whether I click the mneu item or the ToolStrip button in my test
application.

In your application, since the dialog is shown modally, it should get
focused when it is shown. Could you tell me how you show the modal dialog in
your application?

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Bill Below - 07 Mar 2008 18:40 GMT
Hi Linda,

The dialog is displayed by a third-party ActiveX control so I don't know the
details of how it is displayed.  After it comes up the first mouse click has
no effect but the second click does what it should do.  This is true even
when the first click is on the desktop rather than on the dialog.  When the
dialog appears it seems to have focus and I can tab around its controls with
the keyboard but it still shows no reaction to the first click.  It behaves
exactly as if the toolstrip button captures the mouse when clicked and then
releases it at the next click.

I am inclined not to blame the ActiveX control but if you wanted to follow
it up you could download the evaluation version of WSpell from
wintertree-software.com.

Bill

> Hi Bill,
>
[quoted text clipped - 47 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu[MSFT] - 11 Mar 2008 04:42 GMT
Hi Bill,

Thank you for your reply!

I haven't downloaded the evaluation version of WSpell, so I haven't tested
it on my side so far.

Since this is an ActiveX control, I suggest that you use
/CLRTHREADATTRIBUTE linker option to apply the STAThreadAttribute attribute
to the entry point of your program.

For more information on /CLRTHREADATTRIBUTE linker option, please refer to
the following MSDN document:

http://msdn2.microsoft.com/en-us/library/s6bz81ya(VS.80).aspx

Hope this  helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Bill Below - 13 Mar 2008 20:40 GMT
Thanks, Linda

I had CLRTHREADATTRIBUTE set to "no threading attribute set".  I tired MTA
and got a LNK4249 warning "directive /CLRTHREADATTRIBUTE::STA conflicts ...
ignored" for each compile unit and the app wouldn't run.  I set it to STA and
the warnings went away and the app ran but the problem was still there.

Bill

> Hi Bill,
>
[quoted text clipped - 25 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu[MSFT] - 18 Mar 2008 08:28 GMT
Hi Bill,

Thank you for your reply!

I have downloaded the evaluation version of WSpell and have performed
several tests on it.

Firstly, I tested the ActiveX control in a C# Windows Forms application
created by VS2005:
1. Add a MenuStrip and a ToolStrip and a TextBox on the form.
2. Add the WSpell ActiveX control into the Toolbox.
3. Drag the WSpell ActiveX control from the Toolbox and drop it onto the
form.
4. Add a method in the form's code file as follows:

void ShowWSpell()
{
     this.axWSpell1.TextControlHWnd = this.textBox1.Handle.ToInt32();
     this.axWSpell1.Start();
}

5. Call the above method from the Click event handler of the menu item and
the toolstrip button.
6. The result is whether calling the ShowWSpell method from the Click event
handler of the menu item or the toolstrip button, a modal dialog "Check
Spelling" pops up and gets focused.

Secondly, I tested the ActiveX control in a Visual C++ CLR Windows Forms
application created by VS2005:
1.  Add a MenuStrip and a ToolStrip and a TextBox on the form.
2. Drag the WSpell ActiveX control from the Toolbox and drop it onto the
form.
3. Add a method in the form's code file as follows:

void ShowWSpell()
{
    this->axWSpell1->TextControlHWnd = this->textBox1->Handle.ToInt32();
    this->axWSpell1->Start();
}

4. Call the above method from the Click event handler of the menu item and
the toolstrip button.
5. The result is whether calling the ShowWSpell method from the Click event
handler of the menu item or the toolstrip button, a modal dialog "Check
Spelling" pops up and gets focused.

Could you tell me what the kind of your application is?
If the problem is still not solved, could you please send me a sample
project that could just reproduce the problem? To get my actual email
address, remove 'online' from my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Bill Below - 27 Mar 2008 17:38 GMT
Hi Linda,

I am grateful for and REALLY IMPRESSED with the level of attention you have
given my problem.  I think the best way to proceed is for me to make a sample
that reproduces the problem without the baggage of my application.  This will
take a few days.  

Thanks,
Bill

> Hi Bill,
>
[quoted text clipped - 58 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.