icuurd12b42 Posted January 7, 2013 Posted January 7, 2013 (edited) I had a ton of problems with ToolTip. Mainly it showed tips on top of everything. when my application was behind or minimised the tips would show tip on the desktop over another app, confusing people. This alternative uses a stub edit box's tool tip to replace ToolTip, It will stick to the main window, not go on top of everything and not display if the window is minimized or invisible. I also added message importance, along with a control variable so you can tone down how many messges you generate for informing the user. the required control variables global $control_MaxMsgLevel = 3; what level of messages allowed to show global $control_ShowTrayMsg = 1; display in tray if minimised global $control_TimeOutFac = 1; a time multiplication factor so message stick longer or shorter global $control_LogMsg = 0; for logging, logging code not included global $hMainWnd; set to your GUI the function global $stube = -1; func OnHideTip() _GUICtrlEdit_HideBalloonTip(GUICtrlGetHandle($stube)); AdlibUnRegister("OnHideTip"); EndFunc Func Tip($x,$y,$title,$message,$icon,$level,$ctrl = 0,$timeoutS = 1,$delay = 0) if($level>$control_MaxMsgLevel) then return 0; local $lx = $x; local $ly = $y; if($ctrl) Then local $pos = _WinAPI_GetWindowPlacement($hMainWnd); local $wx = DllStructGetData($pos, "rcNormalPosition",1) local $wy = DllStructGetData($pos, "rcNormalPosition",2) local $tRect = _WinAPI_GetWindowRect(GUICtrlGetHandle($ctrl)); $lx += (DllStructGetData($tRect, "Left") + DllStructGetData($tRect, "Right"))/2 -$wx; $ly += (DllStructGetData($tRect, "Top") + DllStructGetData($tRect, "Bottom"))/2 -$wy-28; EndIf if($stube = -1) Then $stube = GUICtrlCreateEdit("",$lx,$ly,0,0); _WinAPI_ShowWindow(GUICtrlGetHandle($stube), @SW_HIDE); EndIf GUICtrlSetPos($stube,$lx,$ly); _GUICtrlEdit_ShowBalloonTip(GUICtrlGetHandle($stube), $title,$message,$icon); AdlibUnRegister("OnHideTip"); AdlibRegister("OnHideTip",$timeoutS*$control_TimeOutFac * 1000); if($control_ShowTrayMsg and IsMinimized()) then TrayTip($title,$message,$timeoutS*$control_TimeOutFac,$icon); if($control_LogMsg) then LogMessage($title, $message) if($delay) sleep($timeoutS*$control_TimeOutFac * 1000); EndFunc func IsMinimized() return ((WinActive("[ACTIVE]") = 16) or (_WinAPI_IsWindowVisible($hMainWnd) = 0)); EndFunc to call Level 0, message always show if control_MaxMsgLevel is 0 or higher Tip(0,0,"Error","There was a problem",$TTI_ERROR,0,$ctrl_UserDD) Level 2 will only show if the options are set to display message of that high verbose level control_MaxMsgLevel = 2 or higher Tip(0,0,"Tip","Did you know you can lower the tip level so this does not show anymore",$TTI_INFO,2,$ctrl_UserDD) Edited January 9, 2013 by icuurd12b42
careca Posted January 9, 2013 Posted January 9, 2013 Hey, just, good job. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
icuurd12b42 Posted January 9, 2013 Author Posted January 9, 2013 (edited) Thanks. I just reformatted the code in the main post. the format was ruined when I edited it last time Edited January 9, 2013 by icuurd12b42
Luigi Posted February 5, 2013 Posted February 5, 2013 Nice work! _GUICtrlEdit_ShowBallonTip does not work with buttons, your function work! God job! Visit my repository
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