Notifications
Clear all

[Closed] dot net label tool tip

Hello guys. I’ve got a dot net form with labels. I want a mouse hover over the labels to produce tool tip messages. What’s the quickest way to do this? Or should I be using a dot net button instead? thnx for your patience.

9 Replies

and? where is a problem?

try(form.close()) catch()
(
	global form = dotnetobject "Form"
	form.Text = "Label ToolTips"
	form.ShowInTaskbar = off
	
	form.Size = dotnetobject "System.Drawing.Size" 240 60
	tt = dotnetobject "ToolTip"
	
	form.controls.addrange \
	(
		for k=0 to 3 collect
		(
			local lb = dotnetobject "Label" 
			lb.Text = "Label" + k as string
			lb.Bounds = dotnetobject "System.Drawing.Rectangle" (k*60+2) 4 60 24
			tt.SetToolTip lb ("You are over the " + lb.text)
			lb
		)
	)
	MaxHandleWrapper = dotnetobject "MaxCustomControls.Win32HandleWrapper" (dotnetobject "System.IntPtr" (windows.getmaxhwnd()))
	form.Show MaxHandleWrapper
	ok
)

Oh settooltip…of course, thnx Denis. What if i wanted a slight shift in the image on hover?

i don’t understand the question. try again

I just want the lable image to be offset a few pixels to indicate a mouse click, say, then pop back.

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

try(form.close()) catch()
(
	global form = dotnetobject "Form"
	form.Text = "Label ToolTips"
	form.ShowInTaskbar = off
	
	form.Size = dotnetobject "System.Drawing.Size" 240 60
	
	fn onMouseDown s e = 
	(
		s.Location.X += 1 
		s.Location.Y += 1
	)
	fn onMouseUp s e = 
	(
		s.Location.X -= 1 
		s.Location.Y -= 1
	)
	form.controls.addrange \
	(
		for k=0 to 3 collect
		(
			local lb = dotnetobject "Label" 
			lb.Text = "Label" + k as string
			lb.Bounds = dotnetobject "System.Drawing.Rectangle" (k*60+2) 4 60 24
			
			dotnet.addEventHandler lb "MouseDown" onMouseDown
			dotnet.addEventHandler lb "MouseUp" onMouseUp
			lb
		)
	)
	MaxHandleWrapper = dotnetobject "MaxCustomControls.Win32HandleWrapper" (dotnetobject "System.IntPtr" (windows.getmaxhwnd()))
	form.Show MaxHandleWrapper
	ok
)

are you happy now ? … but all these is easier to do by using flat buttons with no border.

Thnx denis. So flatbuttons have their own tooltip event?

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

no. tooltip mechanics are the same. but button has some built-in ui solutions. highlight on over, for example. also button has some proprieties that label doesn’t. TextImageRelation is useful one.

TextImageRelation?

1 Reply
(@denist)
Joined: 1 year ago

Posts: 0

why does it surprise you? yes. some .net controls have cool properties.