Message 1 of 7
Button clicks get ignored by a .NET ToolStrip control when window doesn't have focus

Not applicable
05-30-2008
02:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an issue where I can't get a click to pass through to a toolstrip button unless the rollout is focused. To repro the bug, run my code in Max 9+ and click off of the Test rollout and then click the ToolStrip button without having the rollout focused. You'll see that the other two buttons do behave correctly, with the .NET button receiving the click. It seems it is just a problem with the ToolStrip. Is there something on the ToolStrip that I have to set to get that event to pass through?
Here is my code:
Here is my code:
rollout test "Test"
(
button theButton "Press me!" width:50 height:50 pos:
on theButton pressed do
(
messagebox "Remember: Never press unknown buttons!"
)
dotNetControl theDotNetButton "Button" width:50 height:50 pos:
on theDotNetButton Click sender evedntargs do
(
messagebox "Remember: Never press unknown .NET buttons!"
)
--dotNetControl toolStripContainer "ToolStripContainer" width:120 height:50 pos:
dotNetControl toolStrip "ToolStrip" width:120 height:50 pos:
fn ToolStripButtonClick button e =
(
messagebox "Remember: Never press unknown .NET ToolStrip buttons!"
)
on test open do
(
theDotNetButton.Text = ".NET!"
--toolStrip = dotNetObject "ToolStrip"
format "Visible: % Width: % Height: %\n" toolStrip.visible toolStrip.width toolStrip.height
toolStrip.text = "I'm a tool strip"
obj = dotNetObject "ToolStripButton"
obj.width = 50
obj.height = 50
obj.tooltiptext = "ToolTipText"
obj.text = "Tool Strip Button"
dotnet.addeventhandler obj "Click" ToolStripButtonClick
toolStrip.items.add obj
--toolStripContainer.TopToolStripPanel.Controls.Add toolStrip
)
)
createDialog test 150 150