question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `ClickThrough` to `ToolStrip`/`MenuStrip` to bring behavior in-line with other controls.

See original GitHub issue

Background and motivation

There have recently been a couple of issues asking for this feature.

Outline explaining the feature from associated blog post:

ToolStrip classes do not support “Click Through” between forms. For more information on what click through is, I recommend reading https://daringfireball.net/2003/05/interface_details_itunes_vs_safari . In Windows, pretty much all applications use “click through,” whereby if you have one window active and click on to another one, the mouse click activates the window and the click is processed by whatever control you had the mouse over.

https://learn.microsoft.com/en-us/archive/blogs/rickbrew/how-to-enable-click-through-for-net-2-0-toolstrip-and-menustrip

API Proposal

public class ToolStrip
{
   public bool ClickThrough=true;

   protected override void WndProc(ref Message m)
    {
        base.WndProc(ref m);
        if (this.clickThrough &&
            m.Msg == NativeConstants.WM_MOUSEACTIVATE &&
            m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT)
        {
            m.Result = (IntPtr)NativeConstants.MA_ACTIVATE;
        }

    }
}

API Usage

Enable/Disable the ClickThrough property to change the behavior.

Alternative Designs

default value of property set to false

Risks

If default is true, then behavior could change in existing applications.

Will this feature affect UI controls?

Yes. Toolstrip will allow click through by default or at least allow click through after the developer enables it.

Unsure on accessibility impact.

Feature is not localizable.

Issue Analytics

  • State:open
  • Created 3 months ago
  • Reactions:4
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
merriemcgawcommented, Jun 23, 2023

@elachlan you are the absolute best! Go ahead and put up a PR and we’ll review it before the API review so it’s a simple matter to get it in.

1reaction
elachlancommented, Jun 14, 2023

Based on the blog we should probably also add it for MenuStrip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to bind to the Enabled property of a ToolStripMenuItem
I'm having trouble finding the correct way to bind to the Enabled property of a ToolStripMenuItem . Most controls have a .DataBindings property, ......
Read more >
How to: Add ToolStrip Items Dynamically - Windows Forms ...
Learn how to dynamically add ToolStrip items to a ContextMenuStrip control and reuse the same control for several different controls on the ...
Read more >
NET Core Win form toolStripMenuItem does not work VS ...
For me, the resolution is to go into the designer code and manually add a click handler - noting also that using the...
Read more >
Custom VisualStudio2008 style MenuStrip and ToolStrip ...
If you haven't already got a MenuStrip and/or ToolStrip control, add them now. You can rightclick them and choose "Insert Standard Items" to ......
Read more >
Can't add controls on inherited form - C# / C Sharp - Bytes
I can't seem to add new controls to form that is inherited from another form. I have BaseForm wich have table layout on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found