[Closed] Tooltips causing windows to be sent behind 3ds Max window
Hi guys,
I’ve been struggling with this one for ages and have no idea how to fix it.
When you use a dotNet Button, and assign it a tooltip, after the tooltip has been shown some windows will be sent behind 3ds Max. I can repeat this 100% but I have no idea how to fix it. Any help would be appreciated.
I have noticed it only happens to windows that are parented to 3ds Max, but have a separate minimise/maximise button in the taskbar.
This happens with both dotNet forms, rollouts, and compiled C# assemblies. Everything goes back to normal as soon as you close the form.
To replicate:
- Run code below to open a form.
- Hover over the button to show the tooltip
- Open 3ds Max Help window (older versions of max) or Vray Frame Buffer.
The window just opened immediately goes behind 3ds Max.
DotNetForm:
mf = dotNetObject "maxCustomControls.maxForm"
btn = dotNetObject "button"
tt = dotNetObject "tooltip"
tt.setToolTip btn "This is a Tooltip"
mf.controls.add(btn)
mf.showmodeless()
DotNetForm with events to remove tooltip (still does not work)
global test
struct testStr (
mf = dotNetObject "maxCustomControls.maxForm",
btn = dotNetObject "button",
tt = dotNetObject "tooltip"
)
test = testStr()
test.mf.controls.add(test.btn)
test.mf.showmodeless()
fn addToolTips s e = (
print "adding tooltip"
test.tt.setToolTip s "This is a Tooltip"
)
fn removeToolTips s e = (
print "removing tooltip"
test.tt.removeAll()
)
dotNet.addEventHandler test.btn "MouseEnter" addToolTips
dotNet.addEventHandler test.btn "MouseLeave" removeToolTips
Rollout (Code copied from LoneRobot post. Press buttons first to add tooltips):
rollout DotNetTest ""
(
dotnetcontrol mbutton "System.Windows.Forms.Button" height:60 width:60 pos:[5,5]
dotnetcontrol mbutton2 "System.Windows.Forms.Button" height:60 width:60 pos:[75,5]
on dotnettest open do
(
ToolTipObj = dotnetobject "System.Windows.Forms.ToolTip"
ToolTipObj.SetToolTip mbutton "Funky cold medina"
ToolTipObj.Active = True
ToolTipObj.tooltipicon = (dotnetclass "System.Windows.Forms.ToolTipIcon").warning
-- other types of tooltip icon are
--.Error
-- .info
-- .none
ToolTipObj2= dotnetobject "System.Windows.Forms.ToolTip"
ToolTipObj2.SetToolTip mbutton2 "Get out of my dreams, get into my car"
ToolTipObj2.Active = True
ToolTipObj2.isballoon = True
)
)
createdialog dotnettest 145 75 style:#(#style_toolwindow, #style_sysmenu)
Does anyone have any idea how to fix this? I’m really surprised that removing the tooltip completely does not work.
Cheers in advance for any help on this!
Tim
I have managed to find a pretty hacky solution to this problem. Completely disposing the tooltip seems to fix the problem, so using MouseEnter and MouseLeave events to dynamically create and dispose tooltips seems to fix the problem.
global test
struct testStr (
mf = dotNetObject "maxCustomControls.maxForm",
btn = dotNetObject "button"
)
test = testStr()
test.mf.controls.add(test.btn)
test.mf.showmodeless()
fn addToolTips s e = (
print "adding tooltip"
tt = dotNetObject "tooltip"
tt.setToolTip s "This is a Tooltip"
s.tag = tt
)
fn removeToolTips s e = (
print "removing tooltip"
tt = s.tag
tt.removeAll()
tt.dispose()
)
dotNet.addEventHandler test.btn "MouseEnter" addToolTips
dotNet.addEventHandler test.btn "MouseLeave" removeToolTips
This is a pretty ugly solution though, so I’ll keep looking.