LWC Posted January 11, 2011 Share Posted January 11, 2011 If, for example, someone leaves a GUICtrlCreateInput empty, I would like that input's tooltip to be displayed when the user clicks a nearby button. Is it possible? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2011 Moderators Share Posted January 11, 2011 LWC, You could always cheat - like this: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 200, 20) GUICtrlSetTip(-1, "I am the normal ToolTip") $hButton = GUICtrlCreateButton("Go!", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $aGUIPos = WinGetPos($hGUI) $aCtrlPos = ControlGetPos($hGUI, "", $hInput) ToolTip("I am the other ToolTip", $aGUIPos[0] + $aCtrlPos[0] + 100, $aGUIPos[1] + $aCtrlPos[1] + 30) Sleep(1000) ToolTip("") EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
LWC Posted January 11, 2011 Author Share Posted January 11, 2011 It's not only "cheating", but uses tooltip which dissapears based on time rather than movement (like GUICtrlSetTip does). Isn't there a direct way to trigger GUICtrlSetTip? Link to comment Share on other sites More sharing options...
Mat Posted January 11, 2011 Share Posted January 11, 2011 The closest I could find was _GUICtrlEdit_ShowBalloonTip. It might be what you want... AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2011 Moderators Share Posted January 11, 2011 LWC, Not the most gracious reply I have ever seen. Isn't there a direct way to trigger GUICtrlSetTip?If I knew how to do that I would have told you directly. based on time rather than movementWe could look to see if the cursor was still over the button: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 200, 20) GUICtrlSetTip(-1, "I am the normal ToolTip") $hButton = GUICtrlCreateButton("Go!", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $aGUIPos = WinGetPos($hGUI) $aCtrlPos = ControlGetPos($hGUI, "", $hInput) ToolTip("I am the other ToolTip", $aGUIPos[0] + $aCtrlPos[0] + 100, $aGUIPos[1] + $aCtrlPos[1] + 30) While 1 $aCInfo = GUIGetCursorInfo() If $aCInfo[4] <> $hButton Then ExitLoop Sleep(10) WEnd ToolTip("") EndSwitch WEnd Any better. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mat Posted January 11, 2011 Share Posted January 11, 2011 And that is a new record ladies and gentlemen!! At 15:21 on the 11th of January 2011 Melba23 managed to quintuple post, improving on the previous record of 3 held by various members. Controversially it came at a time when there were many bugs in the forum, though none of the official adjudicators was available to comment on whether this affected the record breaking feat. Nevertheless, this is surely an event for the history books. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2011 Moderators Share Posted January 11, 2011 (edited) Sorry all - I only meant to post the one. I suppose I will get accused of trying to bump my post count next! M23 Edit: See, I can do it when the forum lets me! Edited January 11, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mat Posted January 11, 2011 Share Posted January 11, 2011 Ok, one problem after another for this This is what I have. $hBtn is a handle NOT a control id... who knows why when both places that use it quite clearly say 'id'. $tNMHDR = DllStructCreate($tagNMHDR) DllStructSetData($tNMHDR, "hwndFrom", $hTooltip) DllStructSetData($tNMHDR, "idFrom", $hBtn) DllStructSetData($tNMHDR, "code", $TTN_SHOW) _SendMessage($hBtn, $WM_NOTIFY, $hBtn, DllStructGetPtr($tNMHDR)) Even if I input $hTooltip manually to what it should be, still not luck. Here's what I was testing on: #include <StructureConstants.au3> #include <WindowsConstants.au3> #include <TooltipConstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test Tooltip") $iBtn = GUICtrlCreateButton("Hover here!", 200, 200, 100, 30) GUICtrlSetTip(-1, "Boo!") $hBtn = GUICtrlGetHandle(-1) $hTest = GUICtrlCreateButton("Test", 100, 100, 100, 30) GUISetState() $hTooltip = 0 ; ?????????? While 1 Switch GUIGetMsg() Case -3 ExitLoop Case $hTest $tNMHDR = DllStructCreate($tagNMHDR) DllStructSetData($tNMHDR, "hwndFrom", $hTooltip) DllStructSetData($tNMHDR, "idFrom", $hBtn) DllStructSetData($tNMHDR, "code", $TTN_SHOW) _SendMessage($hBtn, $WM_NOTIFY, $hBtn, DllStructGetPtr($tNMHDR)) EndSwitch WEnd AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now