The issue I'm having, I'll try to describe it as good as I can.
Basically, I have two (or more) forms, each having a toolstrip with buttons on them. If I click on a button on a toolstrip that is on a window that doesn't have focus at the moment, the button itself is never pressed, but the window gets focus.
Simply put, I need to doubleclick on the button for it to trigger the click event, but only if the window itself did not have focus.
I'm wondering if there is a workaround for this behaviour? Or did I miss some not so obvious property somewhere?
Last edited by ixilom; November 15th, 2009 at 02:44 AM.
Reason: Changed title to contain [SOLVED]
That doesn't happen for me. I created two forms with tool strips, set focus to one, hovered over the toolstrip on the other and it was highlighted. I clicked and the menu appeared. So, it likely something that you are doing in your code which is causing the issue.
Hmm, thats odd... I did a test app with barely any code in it.
Form1 and Form2, both have a toolstrip with 2 buttons.
The only code I added was to create the Form2 and to respond to the first button on the toolstrip placed on Form1.
Yet, it doesn't do what it is supposed to do >:|
I'm using .NET 3.5 on Vista64 Ultimate with all the latest SP/patches if that helps?
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Form2 f = new Form2();
f.Show();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
MessageBox.Show("hello");
}
}
}
Oh, forgot to mention that the hovering does however make the button highlight.
----
Today, I tested this on my laptop with XP SP2 and I get the same results... I still need to doubleclick on the button in the toolbar to make it trigger the event... argh!
Last edited by ixilom; November 13th, 2009 at 06:42 AM.
Reason: Completion
Apparently MS decided that it would be good to "eat" the mouseclick when you activate another window.
The "hack" mentioned in the article above will re-enable the sane behaviour
Bookmarks