Tooltip on disabled button << Back



TL;DR -
	Object oDisabledButton is a Button
		Set Enabled_State to False
		Set pbUseFormWindowHandle to False
		Set psTooltip to "Test"
	End_Object

In Microsoft Windows world, when you assign a tooltip to a disabled UI control, the tooltip will not show. Thus, if you set a tooltip to a disabled Button, the tooltip won't show. The question becomes - what if I want to show the tooltip regardless whether it is enabled or not (maybe I want to show a tooltip to the users explaining why the Button is disabled in the first place)

Whenever you assign a tooltip to a Windows UI control, VDF has to determine whether you want to assign the tooltip to the Window_Handle or Form_Window_Handle. Button, by default, will assign the tooltip control to the Form_Window_Handle. However when you set Enabled_State to False to a button, it only disables the Form_Window_Handle. The parent window, Window_Handle, is still enabled. We can use this loophole to let the tooltip control to show on a seemingly disabled control.

Use Windows.pkg
Use cToolTipController.pkg
Object oTooltipController is a cToolTipController
	Move Self to ghoToolTipController
End_Object
Object oPanel is a ModalPanel
	Set Size to 100 80
	Object oButton is a Button
		Set Label to "Tooltip yes"
		Set Enabled_State to False
		Set pbUseFormWindowHandle to False
		Set psToolTip to "Tooltip"
	End_Object
	Object oButton is a Button
		Set Location to 15 0
		Set Label to "Tooltip no"
		Set Enabled_State to False
		Set psToolTip to "Tooltip"
	End_Object
	Object oButton is a Button
		Set Location to 30 0
		Set Label to "Tooltip yes"
		Set psToolTip to "Tooltip"
	End_Object
End_Object

Send Popup of oPanel
Free Web Hosting