Jump to content

EasyTips - Simple Custom GUI Control ToolTips


Skitty
 Share

Recommended Posts

Ever wanted a custom GUI tooltip with custom colors, icon and delay time?

Well everyone probably knows about the GUIToolTips UDF included with autoit but the lack of examples and documentation makes using it a hassle. (For me at least...)

Here I present a small UDF wrapper with one function designed as a wrapper for the udf to make it simple to add a custom tooltip without the need for various different calls to different functions to set a particular style for the tooltip.

I made it with the intention of being an alternative for GuiCtrlSetTip().

Example

#include <EasyTip.au3>

; GuiCtrlSetTip
GUICreate("Form1", 296, 170, -1, -1)
GUICtrlCreateButton("OEM", 8, 8, 81, 25)
GUICtrlSetTip(-1,"Test tip with just text.")
GUICtrlCreateButton("OEM 2", 8, 33, 81, 25)
GUICtrlSetTip(-1,"Test tip with text and title.","Optional title")
GUICtrlCreateButton("OEM 3", 8, 59, 81, 25)
GUICtrlSetTip(-1,"Test tip with text, title and Icon.","Optional title",1)
GUICtrlCreateButton("OEM 4", 8, 84, 81, 25)
GUICtrlSetTip(-1,"Test tip with text, title, Icon & balloon style.","Optional title",1,1)
GUICtrlCreateButton("OEM 5", 8, 109, 81, 25)
GUICtrlSetTip(-1,"Test tip with text, title, Icon & hovering under control.","Optional title",1,2)
GUICtrlCreateButton("OEM 6", 8, 135, 81, 25)
GUICtrlSetTip(-1,"Test tip with text, title, Icon & hovering under control with stem pointing to item.","Optional title",1,3)


; _GuiCtrlSetTip
GUICtrlCreateButton("Custom 1", 90, 8, 81, 25)
_GUICtrlSetTip(-1,"Test tip with just text.")
GUICtrlCreateButton("Custom 2", 90, 33, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text and title.","Optional title")
GUICtrlCreateButton("Custom 3", 90, 59, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title and Icon.","Optional title",1)
GUICtrlCreateButton("Custom 4", 90, 84, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Icon & balloon style.","Optional title",1,1)
GUICtrlCreateButton("Custom 5", 90, 109, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Icon & hovering under control.","Optional title",1,2)
GUICtrlCreateButton("Custom 6", 90, 135, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Icon & hovering under control with stem pointing to item.","Optional title",1,3)
GUICtrlCreateButton("Custom 7", 172, 8, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon & hovering under control with stem pointing to item.","Optional title",@SystemDir & "\taskmgr.exe,107",3)
GUICtrlCreateButton("Custom 8", 172, 33, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon, hovering under control with stem pointing to item & custom colors.","Optional title",@SystemDir & "\taskmgr.exe,107",3,0x000000,0x00ff00)
GUICtrlCreateButton("Custom 9", 172, 59, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon, hovering under control with stem pointing to item, custom colors and custom delay time.","Optional title",@SystemDir & "\taskmgr.exe,107",3,0x000000,0x00ff00,1000)
GUICtrlCreateButton("Example 1", 172, 84, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon, hovering under control with stem pointing to item & custom colors.","Optional title",@SystemDir & "\taskmgr.exe,107",0,0x000000,0x00ff00)
GUICtrlCreateButton("Example 2", 172, 109, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon, hovering under control with stem pointing to item & custom colors.","Optional title",@SystemDir & "\taskmgr.exe,107",1,0x000000,0x00ff00)
GUICtrlCreateButton("Example 3", 172, 135, 81, 25)
_GUICtrlSetTip(-1,"Test tip with text, title, Custom Icon, hovering under control with stem pointing to item & custom colors.","Optional title",@SystemDir & "\taskmgr.exe,107",2,0x000000,0x00ff00)
GUISetState(@SW_SHOW)
While GUIGetMsg() <> -3
WEnd

EasyTip.rar

Edit: Fixed error...

Edited by ApudAngelorum
Link to comment
Share on other sites

  • 1 month later...

Thanks for sharing.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

  • 1 year later...

This UDF won't work with the latest version of AutoIt, the GUIToolTip UDF that this is based off of has been extensively rewritten and the function calls in this udf are all written wrong for it.

BTW, you probably don't need this any longer as the rewrite made using the GUIToolTip UDF a hell of a lot easier than it was.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...