Jump to content

Recommended Posts

Posted

Hey,

I didn't even solved the problem with the _MsgBox but I've already found another problem...

I have created a traymenu (no GUI at all). When I click a trayitem a GUI shows up with options.

There are several buttons in it but they don't work.

I don't know where to put the variables in.

Because when I put them in the while loop from the traymenu SciTE gives errors that there are several unknown variables because the optionsdialog is a functions so SciTE hasn't read this variables though.

And when I create a new while loop I can't get back into the old while loop so when I delete the GUI the trayitems can not be clicked anymore.

My code:

#Include <Constants.au3>
#include <GuiConstantsEx.au3>
#Include <GuiListView.au3>
#include <ListviewConstants.au3>
#include <_MsgBox.au3>
    
Opt ( "TrayMenuMode", 1 )

$AuthorFullName = "Cas Cornelissen"
$AuthorNickName = "Rawox"
$Title          = "TaskBarHider"
$Version        = "0.1"
$Release        = "21-08-2009"

; Traymenu
$TrayOptions  = TrayCreateItem ( "Options" )
$TrayAbout    = TrayCreateItem ( "About" )
                TrayCreateItem  ( "" ) 
$TrayExit     = TrayCreateItem  ( "Exit" ) 
                TrayItemSetState ( $TrayOptions, $TRAY_DEFAULT )

While 1
    $Traymsg = TrayGetMsg()
    $Guimsg  = GUIGetMsg()
    Select
    Case $Traymsg = $TrayOptions
        optionsDialog()
    Case $Traymsg = $TrayAbout
        _MsgBox ( 64, "About " & $Title & " " & $Version, $Title & " is created by "& $AuthorFullName & " (a.k.a. " & $AuthorNickName & ")." & @CRLF & "Current version is version " & $Version & " released on " & $Release & ".", 0, 0, "Website|Email|Close" )
    Case $Traymsg = $TrayExit
        Exit
    EndSelect
WEnd

Func optionsDialog()
    $optionsDialog      =   GUICreate               ( $Title & " " & $Version & " Options", 350, 400 )
                            GUICtrlCreateGroup      ( "Options", 10, 10, 330, 50 )
    $CheckEnable        =   GUICtrlCreateCheckbox   ( "Enable " & $Title, 30, 28 )
    $CheckStartWindows  =   GUICtrlCreateCheckbox   ( "Start with Windows", 165, 28 )
                            GUICtrlCreateGroup      ( "Application management", 10, 70, 330, 202 )
    $List               =   GUICtrlCreateListView   ( "", 30, 95, 290, 130 )
    $AddItem            =   GUICtrlCreateButton     ( "Add item", 30, 234, 95, 24 )
    $DeleteSelected     =   GUICtrlCreateButton     ( "Delete", 128, 234, 95, 24 )
    $ClearList          =   GUICtrlCreateButton     ( "Clear list", 226, 234, 95, 24 )
                            GUICtrlCreateGroup      ( "Overview", 10, 282, 330, 78 )
                            GUICtrlCreateLabel      ( "Status:", 30, 308 )
                            GUICtrlCreateLabel      ( "Items:", 190, 308 )
                            GUICtrlCreateLabel      ( "Items hidden:", 30, 326 )
                            GUICtrlCreateLabel      ( "Most hidden:", 190, 326 )
    $Status             =   GUICtrlCreateLabel      ( "00", 110, 308 )
    $Items              =   GUICtrlCreateLabel      ( "00", 110, 326 )
    $Itemshidden        =   GUICtrlCreateLabel      ( "00", 270, 308 )
    $Mosthidden         =   GUICtrlCreateLabel      ( "00", 270, 326 )
    $Reset              =   GUICtrlCreateButton     ( "Reset", 10, 367, 107, 24 )
    $SaveConfiguration  =   GUICtrlCreateButton     ( "Save", 122, 367, 107, 24 )
    $CloseOptions       =   GUICtrlCreateButton     ( "Close", 233, 367, 107, 24 )
                            _GUICtrlListView_AddColumn ( $List, "Nr.", 28 )
                            _GUICtrlListView_AddColumn ( $List, "Title", 80 )
                            _GUICtrlListView_AddColumn ( $List, "Codename", 72 )
                            _GUICtrlListView_AddColumn ( $List, "Text", 50 )
                            _GUICtrlListView_AddColumn ( $List, "Status", 60 )
                            _GUICtrlListView_AddColumn ( $List, "Hidden", 60 )
                            GUISetState             ( @SW_SHOW, $optionsDialog )
EndFunc









;WinSetState ( "AutoIt Help", "", @SW_HIDE )
  • Moderators
Posted

Rawox,

Here you go:

#Include <Constants.au3>
#include <GuiConstantsEx.au3>
#Include <GuiListView.au3>
#include <ListviewConstants.au3>
;#include <_MsgBox.au3>

Opt ( "TrayMenuMode", 3 )  ; Add no check mode

$AuthorFullName = "Cas Cornelissen"
$AuthorNickName = "Rawox"
$Title          = "TaskBarHider"
$Version        = "0.1"
$Release        = "21-08-2009"

; Traymenu
$TrayOptions  = TrayCreateItem ( "Options" )
$TrayAbout    = TrayCreateItem ( "About" )
                TrayCreateItem  ( "" )
$TrayExit     = TrayCreateItem  ( "Exit" )
                TrayItemSetState ( $TrayOptions, $TRAY_DEFAULT )

While 1
    $Traymsg = TrayGetMsg()
    Select
    Case $Traymsg = $TrayOptions
        optionsDialog()
    Case $Traymsg = $TrayAbout
        MsgBox (0,"About", "Him") ;( 64, "About " & $Title & " " & $Version, $Title & " is created by "& $AuthorFullName & " (a.k.a. " & $AuthorNickName & ")." & @CRLF & "Current version is version " & $Version & " released on " & $Release & ".", 0, 0, "Website|Email|Close" )
    Case $Traymsg = $TrayExit
        Exit
    EndSelect
WEnd

Func optionsDialog()
    $optionsDialog      =   GUICreate               ( $Title & " " & $Version & " Options", 350, 400 )
                            GUICtrlCreateGroup      ( "Options", 10, 10, 330, 50 )
    $CheckEnable        =   GUICtrlCreateCheckbox   ( "Enable " & $Title, 30, 28 )
    $CheckStartWindows  =   GUICtrlCreateCheckbox   ( "Start with Windows", 165, 28 )
                            GUICtrlCreateGroup      ( "Application management", 10, 70, 330, 202 )
    $List               =   GUICtrlCreateListView   ( "", 30, 95, 290, 130 )
    $AddItem            =   GUICtrlCreateButton     ( "Add item", 30, 234, 95, 24 )
    $DeleteSelected     =   GUICtrlCreateButton     ( "Delete", 128, 234, 95, 24 )
    $ClearList          =   GUICtrlCreateButton     ( "Clear list", 226, 234, 95, 24 )
                            GUICtrlCreateGroup      ( "Overview", 10, 282, 330, 78 )
                            GUICtrlCreateLabel      ( "Status:", 30, 308 )
                            GUICtrlCreateLabel      ( "Items:", 190, 308 )
                            GUICtrlCreateLabel      ( "Items hidden:", 30, 326 )
                            GUICtrlCreateLabel      ( "Most hidden:", 190, 326 )
    $Status             =   GUICtrlCreateLabel      ( "00", 110, 308 )
    $Items              =   GUICtrlCreateLabel      ( "00", 110, 326 )
    $Itemshidden        =   GUICtrlCreateLabel      ( "00", 270, 308 )
    $Mosthidden         =   GUICtrlCreateLabel      ( "00", 270, 326 )
    $Reset              =   GUICtrlCreateButton     ( "Reset", 10, 367, 107, 24 )
    $SaveConfiguration  =   GUICtrlCreateButton     ( "Save", 122, 367, 107, 24 )
    $CloseOptions       =   GUICtrlCreateButton     ( "Close", 233, 367, 107, 24 )
                            _GUICtrlListView_AddColumn ( $List, "Nr.", 28 )
                            _GUICtrlListView_AddColumn ( $List, "Title", 80 )
                            _GUICtrlListView_AddColumn ( $List, "Codename", 72 )
                            _GUICtrlListView_AddColumn ( $List, "Text", 50 )
                            _GUICtrlListView_AddColumn ( $List, "Status", 60 )
                            _GUICtrlListView_AddColumn ( $List, "Hidden", 60 )
                            GUISetState             ( @SW_SHOW, $optionsDialog )

    While 1
    $Guimsg  = GUIGetMsg()
        Switch $Guimsg
            Case $Reset
                ConsoleWrite("Resetting" & @CRLF)
            Case $SaveConfiguration
                ConsoleWrite("Saving" & @CRLF)
            Case $CloseOptions, $GUI_EVENT_CLOSE
                GUIDelete($optionsDialog)
                Return ; Gets back to the TraygetMsg loop
        EndSwitch
    WEnd

EndFunc

I also alterred the TrayMenuMode option to 3 to remove the "tick" when you use the tray menu.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

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
×
×
  • Create New...