I apologize for extending this thread but I just wanted to add a couple of penny's worth (or less)...
BooBoo wrote:
... I decided that the tooltips where a bit annoying/distracting and got in the way...
I think that BooBoo's (and my) largest aversion to the cursor-controlled tooltip solution is that tooltips of this nature usually require that the cursor hover over the field a little while (~1 second) before the tooltip is displayed. I made a minor modification to Chris' version and came up with this:
Code:
Gui, Add, Edit, vMyEdit
MyEdit_TT := "This is a tooltip for the control whose variable is MyEdit."
Gui ,Add, DropDownList, vMyDDL, Red|Green|Blue
MyDDL_TT := "Choose a color from the drop-down list."
Gui, Add, Edit, vMyEdit2,This don't got no tip
Gui, Show
OnMessage(0x200,"WM_MOUSEMOVE")
return
WM_MOUSEMOVE()
{
global
CurrControl:=A_GuiControl
if (CurrControl<>PrevControl)
{
SetTimer DisplayToolTip,1000
PrevControl:=CurrControl
}
}
DisplayToolTip:
SetTimer DisplayToolTip,off
ToolTip % %CurrControl%_TT
SetTimer,RemoveToolTip,4000
return
RemoveToolTip:
SetTimer RemoveToolTip,off
ToolTip
return
GuiClose:
ExitApp
BooBoo wrote:
... so as an alternative method of displaying info about controls I modified the code to use the status bar instead.
I like the idea of using the status bar to display object help (hints), but IMHO, the status bar is more appropriate for displaying hints for objects that are in focus. I made some minor modifications to BooBoo's code and came up with this:
Code:
Gui Margin, 2, 2
Gui Add, Edit, w220 vMyEdit
MyEdit_SB := "This control uses the variable MyEdit."
Gui Add, DropDownList, w220 vMyDDL, Red|Green|Blue
MyDDL_SB := "Choose a colour from the drop-down list."
Gui Add, Edit, w220 vMyDDL2,I ain't got no hint
Gui Add, StatusBar,,
Gui Show,,Control info in status bar.
OnMessage(0x101,"UpdateHint") ;-- WM_KEYUP
OnMessage(0x202,"UpdateHint") ;-- WM_LBUTTONUP
UpdateHint()
Return
UpdateHint()
{
static PrevControl,_SB
GUIControlGet CurrControl,FocusV
If (CurrControl<>PrevControl)
{
SB_SetText(%CurrControl%_SB)
PrevControl:=CurrControl
}
}
GuiClose:
ExitApp
There may be more appropriate windows messages to use than the ones I've selected.
Depending on the type of objects you put in your GUI, it may be more efficient to replace the
OnMessage statements with a timer. Of course, the
UpdateHint function must be converted into a subroutine if this were done.
Final thoughts...
Since some objects rarely come into focus (some radio buttons for example), it might be a good idea to use both tooltips (cursor) and the status bar (focus) to display object help. Them be my thoughts...