Sign in to follow this  
Followers 0
anixon

Gui Control Styles

24 posts in this topic

I am using this code to create a window in the place of a Notification Area ToolTip which does not allow you to set the background or text colors. Is there a way that when this window is launched its Icon does not appear

on the Windows Taskbar 'That is the Windows Control which allows you to Minimize. Restore or Close the Window'. Ant..

;//Call the Message Box
_StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED)



;//Display Startup Warning and Information Messages
Func _StartUpMenu($dWidth, $dHeight, $dXaxis, $dYaxis, $dDuration, $dMessage, $dBGColor, $dTextColor, $dStyle)
    While 1
        ;//Exit Menu After nn Minutes Nil Activity
        $MenuCycle = _TimeToTicks(@HOUR, @MIN, @SEC)
        $MenuEndCycle = $MenuCycle + $EndMenuTimer * $dDuration
        Local $sExit, $msg
        ;//Setup Window Pane
        GUICreate($Title, $dWidth, $dHeight, $dXaxis, $dYaxis, $dStyle)
        GUISetState(@SW_HIDE )
        GUISetBkColor($dBGColor)
        GUICtrlCreateLabel($dMessage, 0, 5, $dWidth, 15, $SS_CENTER)
        GUICtrlSetColor(-1, $dTextColor)
        ;$sExit = GUICtrlCreatePic($sDisplay, 0, 0, $dWidth, $dHeight)
        GUISetState()
        ;//Menu Processor:
        While 1
            ;//Exit after nn Minutes
            If _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then
                GUIDelete()
                ExitLoop (2)
            EndIf
            ;//Read the Input Message
            $msg = GUIGetMsg()
            ;//Check for User Input
            Select
                ;//Exit the Application
                Case $msg = $GUI_EVENT_CLOSE; Or $msg = $sExit
                    GUIDelete()
                    ExitLoop (2)
            EndSelect
        WEnd
    WEnd
EndFunc   ;==>_StartUpMenu

Share this post


Link to post
Share on other sites



Have you tried using the $WS_EX_TOOLWINDOW option?

Share this post


Link to post
Share on other sites

Have you tried using the $WS_EX_TOOLWINDOW option?

Thanks for that but it does not produce the requested result Ant..

;//Call the Message Box

_StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED + $WS_EX_TOOLWINDOW)

Share this post


Link to post
Share on other sites

anixon,

If you want to avoid the TaskBar button, just set the parent parameter when you create the GUI. Remember that if you do not have a parent to hand, you can always use the hidden AutoIt window. :huggles:

Try running this short script:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("TaskBar Button Test", 500, 500)

GUISetState()

GUICreate("I have a button!", 200, 100, 100, 100)
GUISetState()

GUICreate("I do not!", 200, 100, 100, 300, -1, -1, $hGUI)
GUISetState()

GUICreate("Nor me!", 200, 100, 100, 500, -1, -1, WinGetHandle(AutoitWinGetTitle()))
GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

I hope that is what you wanted. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

_StartUpMenu($cWidth, $cHeight, $cXAxis, $cYAxis, $Duration, $SysMessage, 0xE0FFFF, 0xFF0000, $WS_POPUPWINDOW + $WS_DISABLED + $WS_EX_TOOLWINDOW)

You are doing that wrong, you don't combine styles like that :D Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Just create a popup window ($WS_POPUPWINDOW)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

anixon,

If you want to avoid the TaskBar button, just set the parent parameter when you create the GUI. Remember that if you do not have a parent to hand, you can always use the hidden AutoIt window. :huggles:

Try running this short script:

#include <guiconstantsex.au3>

$hGUI = GUICreate("TaskBar Button Test", 500, 500)

GUISetState()

GUICreate("I have a button!", 200, 100, 100, 100)
GUISetState()

GUICreate("I do not!", 200, 100, 100, 300, -1, -1, $hGUI)
GUISetState()

GUICreate("Nor me!", 200, 100, 100, 500, -1, -1, WinGetHandle(AutoitWinGetTitle()))
GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

I hope that is what you wanted. :D

M23

Very clever and thank you very much that is exactly what I wanted to achieve what can I say other than thanks again.. Ant.

Having done the testing there is no Window opened by the compiled and running script in order to create the buttonless child so the issue is how to suppress the parent popup style window that is opened and closed by the script from appearing as a button on the taskbar. AutoIT is not running so I cannot use its hidden parent is there another hidden windows window that can be used? Ant..</guiconstantsex.au3>

Edited by anixon

Share this post


Link to post
Share on other sites

Just create a popup window ($WS_POPUPWINDOW)

I am using $WS_POPUPWINDOW which gives me the right type of window box and text like a tooltip but it also puts a button on the taskbar which I am trying to avoid and in my

environment $WS_EX_TOOLWINDOW Creates a Window with controls and in my environment still puts a button on the taskbar Ant..

Share this post


Link to post
Share on other sites

anixon,

AutoIT is not running so I cannot use its hidden parent

When you run a compiled AutoIt script, the hidden AutoIt window is still present so you can still use it to act as a parent to your GUIs. I do this in many of my scripts to avoid a taskbar button. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

anixon,

When you run a compiled AutoIt script, the hidden AutoIt window is still present so you can still use it to act as a parent to your GUIs. I do this in many of my scripts to avoid a taskbar button. Posted Image

M23

Thanks for that information sorry for the silly question but will this still work on a system which does not have AutoIt installed that runs the compiled script and how do you apply the process to a $WS_POPUPWINDOW stype window? Ant..

Share this post


Link to post
Share on other sites

anixon.

As far as I know (because all my systems have AutoIt installed : ) the window will be created by the interpreter which is the major part of the compiled exe. I believe that it needs this GUI to intercept the various Windows messages flying around (but do not quote me on that! :D ).

As to applying this to a $WS_POPUP window, the styles of a GUI have nothing to do with the parent. Look at the syntax for GUICreate:

GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )

You can see that the style and exStyle parameters are independent of the parent parameter we use to prevent the TaskBar button. So to remove the Taskbar button from a $WS_POPUP style GUI, you do the exactly the same - use the parent parameter.

Do not apologise for asking - that is why we are here! :huggles:

M23

P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

M23 You are a GENIUS the following works exactly as required. Given my age so much to learn so little time. I have just downloaded the latest version of AutoIT so I am now looking forward to the next round of what the............ Thanks again M23 Ant..

And the magic:

GUICreate("Nor me!", 200, 100, -1, -1, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoitWinGetTitle()))

Share this post


Link to post
Share on other sites

anixon,

Given my age so much to learn so little time

And what makes you think we are all young.....some of us may have been even be older than you when we started with AutoIt :D .

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Well for me it was either AutoIT or aged care.....

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

And this is the work in progress.

The initial question was can you set the color of the text for a TrayTip message Short Answer 'NO' .

The following code is simply a Message Display Handler offering the user [3] display options [1] Standard Tray Tip, [2] Custom Tray Tip and [3] Splash Message Box. The function call variables controls which Display to Pop.

There will be an additional Custom Box Option developed so that a Box style Pop-up can display colored background and text.

For my purpose the value of colored text is to enhance the 'Good = Green, Bad = Red and Black = Normal' weight of the Message.

A special thanks to those especially Melba23 who help me solve the Toolbar Button and x y display position issues for the Custom Traytip without the help I could not have achieved the required outcome.

Ant.. Posted Image

;#cs
#include <array.au3> ;//Array Processing
#include <Date.au3>  ;//Date Time Processing
#include <EditConstants.au3> ;//Input Box Centering
#include <File.au3> ;//Write to File
#include <GUIConstants.au3> ;///GUI Interface
#include <GUIConstantsEx.au3> ;//GUI Interface
#include <GUIToolBar.au3>;//Cleanup the TaskBar Icon when performing an ProcessClose
#include <StaticConstants.au3> ;//Static Constants
#include <WindowsConstants.au3> ;//Windows Constants

Global $hSysTray_Handle, $iSystray_ButtonNumber, $xAxisNTB, $xAxisIcon, $dXAxis, $dyaxis, $hSysTray_Handle, $iSystray_ButtonNumber, $sToolTipTitle = "Skype", _
  $bGColor = 0xFcFcFe, $TextColorR = 0xFF0000, $TextColorG = 0x008040, $TextColorB = 0x000000, $message, $Title = "Process", _
  $sToolTipTitle, $sMsgDuration, $sMsgDurationX = 1000, $sMessageStyle, $spare1, $spare2, $Font = "sans-serif", $FontSize = 10, $FontWeight = 600, _
  $sMessageHeight = 50, $iMessageHeight = 25, $sMsgTextJust = 32

;//Demo Variables
$sToolTipTitle = "Skype"
$message = "This is the Message"
$dStyle = 1
$TextColor = $TextColorG
$sMsgDuration = 4
$sMessageStyle = 1

;//Message Display Call
_MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message)

;//Message Display Processor [Can be Switched On/Off with Duration Value]
Func _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message)
While 1
  ;//Messaging Switched OFF
  If $sMsgDuration = 0 Then ExitLoop
  ;//Standard ToolTip Style Pop-Up
  If $dStyle = 1 And $sMessageStyle = 0 Then
   ;//Display Pop-Up
   TrayTip("", $message, 5)
   Sleep($sMsgDuration * $sMsgDurationX)
   TrayTip("Clear Previous TrayTip", "", 0)
  EndIf
  ;//Coloured Status ToolTip Style Pop-Up
  If $dStyle = 1 And $sMessageStyle = 1 Then
   $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle)
   ;//'X' Axis [0] 'Y" Axis [2] Windows Notification Bar
   $xAxisNTB = WinGetPos($hSysTray_Handle)
   ;//'X' Axis Icon on Notification Bar
   $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber)
   ;//Calculate Message Box Width [Sans-serif 10 600]
   $dWidth = (StringLen($message) * 6.34) + 15
   ;//Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon
   $dXAxis = $xAxisNTB[0] + $xAxisIcon[0]
   ;//Display Left of Icon [DestopWidth Exceeded]
   If $xAxisNTB[0] + $dWidth + 35 > @DesktopWidth Then $dXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - $dWidth
   ;//Calculate the Y Position of the Message Box [+ 5 =  Gap between Desktop and Notification Toolbar]
   $dyaxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5)
   While 1
    ;//Set the Message Delay Exit Timer
    $MenuCycle = _TimeToTicks(@HOUR, @MIN, @SEC)
    $MenuEndCycle = $MenuCycle + ($sMsgDuration * $sMsgDurationX)
    ;//Display the Pop-UP [WinGetHandle Suppresses the Taskbar Button for this Window]
    GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle()))
    GUISetBkColor($bGColor)
    GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER)
    ;//Black Green or Red
    GUICtrlSetColor(-1, $TextColor)
    GUISetState()
    ;//Exit Message Processor
    While 1
    ;//Exit after nn Minutes
    If _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then
      GUIDelete()
      ExitLoop (2)
    EndIf
    WEnd
   WEnd
  EndIf
  ;//Splash Message Box Style
  If $dStyle = 2 Then
   ;//Set Window Width based on Number of Chrs in First Line of the Message
   $dMessage = StringSplit($message, @CRLF)
   ;//Calculate the Message Box Width
   $MsgWidth = Round(StringLen($dMessage[1]) * $FontSize - 2, -1)
   ;//Set the Default Message Width
   If $MsgWidth < 250 Then $MsgWidth = 250
   ;//Display the Message Box
   SplashTextOn($Title, $message, $MsgWidth, $sMessageHeight, -1, -1, $sMsgTextJust, $Font, $FontSize, $FontWeight)
   ;//Length of display in Milliseconds
   Sleep($sMsgDuration * $sMsgDurationX)
   SplashOff()
  EndIf
  ;//Exit the Message Display Routine
  ExitLoop
WEnd
EndFunc   ;==>_MessageDisplay

Exit

Func _Get_Systray_Index($sToolTipTitle)
; Find systray handle
$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
  MsgBox(16, "Error", "System tray not found")
  Exit
EndIf
; Get systray item count
Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount = 0 Then
  MsgBox(16, "Error", "No items found in system tray")
  Exit
EndIf
; Look for wanted tooltip
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
  If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
Next
If $iSystray_ButtonNumber = $iSystray_ButCount Then
  Return 0 ; Not found
Else
  Return $iSystray_ButtonNumber ; Found
EndIf
EndFunc   ;==>_Get_Systray_Index

;#ce
Edited by anixon

Share this post


Link to post
Share on other sites

anoxon,

I am sure you wil take this in the spirit in which it is sent.... :D

Here is a modified version of your script. There was nothing wrong with what you had - I have a different style and I thought that another view might be of interest.

A few major points to begin with:

1. You should have as few Global variables as you can get away with. There are 2 reasons for this: First, Global variables use memory - Local variables are destroyed when you no longer need them. Second, there is less risk of having a naming conflict and so overwriting something that you should not! If you have time, read Valik's posts in this topic - most enlightening.

2. Switch structures are nearly always faster - and certainly easier to maintain - than multiple If structures.

3, Use TimerInit and TimerDiff for short term timers - _TicksToTime and _TimeToTicks are better suited to longer running events.

So here my version - if you want to look: :D

;#cs
#include <array.au3> ; Array Processing
#include <Date.au3>  ; Date Time Processing
#include <EditConstants.au3> ; Input Box Centering
#include <File.au3> ; Write to File
#include <GUIConstants.au3> ; /GUI Interface
#include <GUIConstantsEx.au3> ; GUI Interface
#include <GUIToolBar.au3>; Cleanup the TaskBar Icon when performing an ProcessClose
#include <StaticConstants.au3> ; Static Constants
#include <WindowsConstants.au3> ; Windows Constants

Global $hSysTray_Handle
;Global $iSystray_ButtonNumber
;Global $xAxisNTB
;Global $xAxisIcon
;Global $dXAxis
;Global $dyaxis
;Global $hSysTray_Handle
;Global $iSystray_ButtonNumber
Global $sToolTipTitle = "Skype"
Global $bGColor = 0xFcFcFe
Global $TextColorR = 0xFF0000
Global $TextColorG = 0x008040
Global $TextColorB = 0x000000
Global $message
Global $Title = "Process"
Global $sToolTipTitle
Global $sMsgDuration
Global $sMsgDurationX = 1000
Global $sMessageStyle
;Global $spare1
;Global $spare2
Global $Font = "sans-serif"
Global $FontSize = 10
Global $FontWeight = 600
Global $sMessageHeight = 50
Global $iMessageHeight = 25
Global $sMsgTextJust = 32

; Demo Variables
$sToolTipTitle = "Skype"
$message = "This is the Message"
$dStyle = 1
$TextColor = $TextColorG
$sMsgDuration = 4
$sMessageStyle = 1

TrayTip("Test", $message, 5)

; Message Display Call
_MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message)

; Message Display Processor [Can be Switched On/Off with Duration Value]
Func _MessageDisplay($spare1, $spare2, $dStyle, $TextColor, $message)
    While 1
        ; Messaging Switched OFF
        If $sMsgDuration = 0 Then ExitLoop
        Switch $dStyle
            
            ; Standard ToolTip Style Pop-Up
            Case 1
                Switch $sMessageStyle
                    ; Display Pop-Up
                    Case 0
                        TrayTip("Test", $message, 5)
                        Sleep($sMsgDuration * $sMsgDurationX)
                        TrayTip("Clear Previous TrayTip", "", 0)
                    ; Coloured Status ToolTip Style Pop-Up
                    Case 1
                        Local $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle)
                        ; 'X' Axis [0] 'Y" Axis [2] Windows Notification Bar
                        Local $xAxisNTB = WinGetPos($hSysTray_Handle)
                        ; 'X' Axis Icon on Notification Bar
                        Local $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber)
                        ; Calculate Message Box Width [Sans-serif 10 600]
                        Local $dWidth = (StringLen($message) * 6.34) + 15
                        ; Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon
                        Local $dXAxis = $xAxisNTB[0] + $xAxisIcon[0]
                        ; Display Left of Icon [DestopWidth Exceeded]
                        If $xAxisNTB[0] + $dWidth + 35 > @DesktopWidth Then $dXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - $dWidth
                        ; Calculate the Y Position of the Message Box [+ 5 =  Gap between Desktop and Notification Toolbar]
                        Local $dyaxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5)
                        While 1
                            ; Set the Message Delay Exit Timer
                            Local $MenuCycle = TimerInit() ; _TimeToTicks(@HOUR, @MIN, @SEC)
                            Local $MenuEndCycle = $sMsgDuration * $sMsgDurationX ; $MenuCycle + ($sMsgDuration * $sMsgDurationX)
                            ; Display the Pop-UP [WinGetHandle Suppresses the Taskbar Button for this Window]
                            Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle()))
                            GUISetBkColor($bGColor)
                            GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER)
                            ; Black Green or Red
                            GUICtrlSetColor(-1, $TextColor)
                            GUISetState()
                            ; Exit Message Processor
                            While 1
                                ; Exit after nn Minutes
                                If TimerDiff($MenuCycle) >= $MenuEndCycle Then ; _TimeToTicks(@HOUR, @MIN, @SEC) >= $MenuEndCycle Then
                                    GUIDelete($hGUI_Message)
                                    ExitLoop (2)
                                EndIf
                            WEnd
                        WEnd
                EndSwitch

            ; Splash Message Box Style
            Case 2
                ; Set Window Width based on Number of Chrs in First Line of the Message
                $dMessage = StringSplit($message, @CRLF)
                ; Calculate the Message Box Width
                Local $MsgWidth = Round(StringLen($dMessage[1]) * $FontSize - 2, -1)
                ; Set the Default Message Width
                If $MsgWidth < 250 Then $MsgWidth = 250
                ; Display the Message Box
                SplashTextOn($Title, $message, $MsgWidth, $sMessageHeight, -1, -1, $sMsgTextJust, $Font, $FontSize, $FontWeight)
                ; Length of display in Milliseconds
                Sleep($sMsgDuration * $sMsgDurationX)
                SplashOff()
        EndSwitch
        ; Exit the Message Display Routine
        ExitLoop
    WEnd
EndFunc   ;==>_MessageDisplay

Exit

Func _Get_Systray_Index($sToolTipTitle)
    ; Find systray handle
    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf
    ; Get systray item count
    Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSystray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf
    ; Look for wanted tooltip
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
    Next
    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return 0 ; Not found
    Else
        Return $iSystray_ButtonNumber ; Found
    EndIf
EndFunc   ;==>_Get_Systray_Index

;#ce

Please ask if anyting is unclear - or if you violently disagree! Remember what I said: there was nothing wrong with what you wrote - it passed the acid test of working correctly : - and this is just another view of how it might be done. :huggles:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I am having an issue with the code [either mine or the Melba23 version] and that is whilst it is running it is taking away the focus from any other window that is open. For example if I am composing a message in Outlook whilst the script is running as soon as the script calls the tool tip routine 'func' I loose focus and can only get it back when I have to click the Outlook window.

I am guess now that this is associated with this Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle())) and the WinGetHandle statement which is required to eliminate the Taskbar button. Any ideas? Ant.. Posted Image Bump

Edited by anixon

Share this post


Link to post
Share on other sites

Bump

Share this post


Link to post
Share on other sites

anixon,

Sorry, missed this last time round.

You need to show, but not activate, the pop-up window - fortunately that is easy to do. :mellow: This should work and prevent the message grabbing the focus:

Local $hGUI_Message = GUICreate($Title, $dWidth, $iMessageHeight, $dXAxis, $dyaxis, $WS_POPUPWINDOW, $WS_EX_TRANSPARENT, WinGetHandle(AutoItWinGetTitle()))
GUISetBkColor($bGColor)
GUICtrlCreateLabel($message, 0, 5, $dWidth, 15, $SS_CENTER)
; Black Green or Red
GUICtrlSetColor(-1, $TextColor)
GUISetState(@SW_SHOWNOACTIVATE, $hGUI_Message) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< !!!!

Does that solve it?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Thank you Melba23 for your assistance which is very much appreciated. The Pop-Up code now works perfectly.

I have made a further modification to the code which better calculates the width of the Pop-up based on the string length and the font sans-serif 9 400 Posted Image

$iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle)
            ;//'X' Axis [0] 'Y" Axis [2] Windows Notification Bar
            $xAxisNTB = WinGetPos($hSysTray_Handle)
            ;//'X' Axis Icon on Notification Bar
            $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber)
            ;//Calculate Message Box Width [Sans-serif 9 400]
            $FontValue = $xFontSize - (0.040 * (StringLen($message) - 10))
            ;//Set Box Width
            $xWidth = StringLen($message) * $FontValue
            ;//Calculate the X Position of the Message Box [Based Width] Display Right of Icon and Left of Icon
            $xXAxis = $xAxisNTB[0] + $xAxisIcon[0]
            ;//Display Right or Left of Icon [Desktop Width Exceeded]
            If $xAxisNTB[0] + $xWidth + $xMaxWidth > @DesktopWidth Then $xXAxis = ($xAxisNTB[0] + $xAxisIcon[2]) - ($xWidth + 5)
            ;//Calculate the Y Position of the Message Box [+ 5 =  Gap between Desktop and Notification Toolbar]
            $xYAxis = $xAxisNTB[1] - ($xAxisNTB[3] + 5)
Edited by anixon

Share this post


Link to post
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
Sign in to follow this  
Followers 0