Sign in to follow this  
Followers 0
Kovacic

_GUICtrlListView_Create vs Tabs - Delay issue

6 posts in this topic

Greetings, I know this subject has been beaten to death and many people have gotten close, but I have not been able to find an actual resolution so far. 

I have a GUI that uses tabs and on the first tab, I have a _GUICtrlListView_Create, and at first, no matter what tab you changed it to, that control would show right through anything else. I was able to fix it by hiding the control much like the Dev team advised when handling tabs. My only concern is the control has a delay when hiding, and when coming back when I switch tabs. 

Has anyone been able to find a way around this?

I am including the code here and attaching the AU3 for convenience..

On a side note, chunks of this code not related to the problem will be removed because I am borrowing from some of my other scripts.

#region INCLUDES
#include <ButtonConstants.au3 >
#include <ComboConstants.au3  >
#include <GUIConstantsEx.au3  >
#include <GuiStatusBar.au3    >
#include <Misc.au3            >
#include <GUIListViewEx.au3   >
#include <StaticConstants.au3 >
#include <TabConstants.au3    >
#include <WindowsConstants.au3>
#endregion INCLUDES
#region GLOBALS
Global $reportsfile     = "SWAT_Report"
Global $Settingsinifile = "SWAT_Settings.ini"
Global $commandsfile    = "SWAT_Commands.ini"
Global $Jobsfile        = "SWAT_Jobs.ini"
Global $RegLoc          = "HKEY_LOCAL_MACHINE\SOFTWARE\SWAT\"
Global $bgcolor         = 0xEEEEEE
Global $dll             = DllOpen("user32.dll")
Global $ToolMacro1      = "Empty Macro"
#endregion GLOBALS
#region Defaults
GUICtrlSetDefBkColor($GUI_BKCOLOR_TRANSPARENT)
#endregion Defaults
#region GUI
$MainGui             = GUICreate("Form2", 1108, 722, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $DS_SETFOREGROUND))
$Menu_File           = GUICtrlCreateMenu("File")
$Menu_File_Exit      = GUICtrlCreateMenuItem("Exit", $Menu_File)
$Menu_Action         = GUICtrlCreateMenu("Action")
$Menu_Action_Start   = GUICtrlCreateMenuItem("Start", $Menu_Action)
$Menu_Help           = GUICtrlCreateMenu("Help")
$Menu_Help_About     = GUICtrlCreateMenuItem("About", $Menu_Help)
$Menu_Help_ChangeLog = GUICtrlCreateMenuItem("Change Log", $Menu_Help)
$Tabs                = GUICtrlCreateTab(0, 0, 793, 425, 0272)
#region "Run Job"
$T_RunJob                 = GUICtrlCreateTabItem("Run Job")
;$RunJob_Jobs             = GUICtrlCreateListView("col1  |col2|col3  ", 8, 49, 777, 161)
Global $RunJob_Jobs       = _GUICtrlListView_Create($MainGui, " Job Name | Commands | Computers | OnDemand ", 8, 49, 777, 161, BitOR($LVS_DEFAULT, $WS_BORDER, $LVS_EDITLABELS))
_GUICtrlListView_SetExtendedListViewStyle($RunJob_Jobs, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_BORDERSELECT, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
_GUICtrlListView_SetColumnWidth($RunJob_Jobs, 0, 140)
_GUICtrlListView_SetColumnWidth($RunJob_Jobs, 1, 300)
_GUICtrlListView_SetColumnWidth($RunJob_Jobs, 2, 180)
_GUICtrlListView_SetColumnWidth($RunJob_Jobs, 3, 75)
Global $init2             = _GUIListViewEx_Init($RunJob_Jobs, "", 0, 0x00FF00)
$RunJob_B_StartJob        = GUICtrlCreateButton("Start Selected Job", 8, 217, 123, 25)
$RunJob_B_AddComps        = GUICtrlCreateButton("Add Selected Computers", 640, 217, 147, 25)
$RunJob_B_RefreshCompList = GUICtrlCreateButton("Refresh Computer List", 640, 249, 147, 25)
GUICtrlCreateLabel("JOBS STATUS", 8, 257, 278, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
GUICtrlCreateLabel("Jobs", 8, 33, 26, 17)
$RunJob_Status            = GUICtrlCreateLabel("Running", 288, 257, 147, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
$RunJob_Currently         = GUICtrlCreateLabel("Currently", 8, 305, 161, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
$RunJob_PercentComplete   = GUICtrlCreateLabel("100%", 176, 305, 106, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
$RunJob_Complete          = GUICtrlCreateLabel("complete", 288, 305, 165, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Arial")
#region "Job Builder"
$T_JobBuilder                 = GUICtrlCreateTabItem("Job Builder")
$JobBuilder_Commands          = GUICtrlCreateListView("Command Name | Command String              ", 8, 73, 393, 345)
GUICtrlSetData(-1, "")
$JobBuilder_JobList           = GUICtrlCreateTreeView(552, 73, 233, 345)
GUICtrlCreateLabel("Commands", 8, 57, 56, 17)
GUICtrlCreateLabel("Job List", 552, 57, 40, 17)
$JobBuilder_B_RefreshCommands = GUICtrlCreateButton("Refresh", 296, 41, 75, 25)
$JobBuilder_B_RefreshJobList  = GUICtrlCreateButton("Refresh", 704, 41, 75, 25)
$JobBuilder_B_AddCommand      = GUICtrlCreateButton("Add Command >>", 416, 361, 123, 25)
$JobBuilder_B_RemoveCommand   = GUICtrlCreateButton("<< Remove Command", 416, 393, 123, 25)
$JobBuilder_B_CreateJob       = GUICtrlCreateButton("Create new Job", 416, 113, 123, 25)
$JobBuilder_B_RemoveJob       = GUICtrlCreateButton("Remove Job", 416, 145, 123, 25)
#region "Command List"
$T_CommandList                = GUICtrlCreateTabItem("Command List")
$CommandList_CommandString    = GUICtrlCreateInput("", 144, 393, 633, 22)
$CommandList_CommFriendlyName = GUICtrlCreateInput("", 8, 393, 121, 22)
$CommandList_CommandList      = GUICtrlCreateListView("Command Name | Command String              ", 8, 33, 769, 281)
GUICtrlCreateLabel("Command Friendly Name", 8, 377, 121, 17)
GUICtrlCreateLabel("Command String", 144, 377, 81, 17)
$CommandList_B_Add            = GUICtrlCreateButton("Add", 8, 321, 75, 25)
$CommandList_B_Edit           = GUICtrlCreateButton("Edit", 96, 321, 75, 25)
$CommandList_B_Delete         = GUICtrlCreateButton("Delete", 184, 321, 75, 25)
#region "Results"
$T_Results       = GUICtrlCreateTabItem("Results")
$Results_Results = GUICtrlCreateEdit("Edit4", 8, 33, 777, 337)
$Results_B_TBD1  = GUICtrlCreateButton("TBD", 8, 377, 75, 25)
$Results_B_TBD2  = GUICtrlCreateButton("Button23", 88, 377, 75, 25)
$Results_B_TBD3  = GUICtrlCreateButton("Button24", 168, 377, 75, 25)
#region "Compare Reports"
$T_CompareReports                  = GUICtrlCreateTabItem("Compare Reports")
GUICtrlCreateGroup("", 16, 241, 761, 177)
$CompResults_CompareResults        = GUICtrlCreateEdit("CompResults_B3", 20, 256, 670, 153)
$CompResults_B_CompareResults_Save = GUICtrlCreateButton("Save as", 696, 385, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$CompResults_LeftEdit              = GUICtrlCreateEdit("CompResults_B1", 16, 41, 300, 201)
$CompResults_RightEdit             = GUICtrlCreateEdit("CompResults_B2", 472, 41, 305, 201)
$CompResults_B_LoadLeft            = GUICtrlCreateButton("<< Load Results", 328, 41, 131, 25)
$CompResults_B_LoadRight           = GUICtrlCreateButton("Load Results >>", 328, 73, 131, 25)
$CompResults_B_GenerateCompare     = GUICtrlCreateButton("Generate Comparison", 328, 209, 131, 25)
#region "Preferences"
$T_Preferences                  = GUICtrlCreateTabItem("Preferences")
GUICtrlCreateGroup("Domain Account with Admin Rights", 16, 33, 281, 153)
GUICtrlSetBkColor(-1, $bgcolor)
$Preferences_DomainUsername     = GUICtrlCreateInput("", 24, 65, 150, 22)
$Preferences_DomainPass         = GUICtrlCreateInput("", 24, 145, 150, 22)
GUICtrlCreateLabel("Username", 24, 49, 52, 17)
GUICtrlCreateLabel("Domain", 24, 89, 40, 17)
$Preferences_DomainDomain       = GUICtrlCreateInput("", 24, 105, 150, 22)
GUICtrlCreateLabel("Password", 24, 129, 50, 17)
$Preferences_B_DomainValidate   = GUICtrlCreateButton("Validate", 208, 153, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Local Account with Admin Rights", 16, 193, 281, 105)
GUICtrlSetBkColor(-1, $bgcolor)
$Preferences_LocalPass          = GUICtrlCreateInput("", 24, 265, 150, 22)
GUICtrlCreateLabel("Password", 24, 249, 40, 17)
$Preferences_LocalUsername      = GUICtrlCreateInput("", 24, 225, 150, 22)
GUICtrlCreateLabel("Username", 24, 209, 52, 17)
$Preferences_B_LocalValidate    = GUICtrlCreateButton("Validate", 208, 265, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("File Locations", 304, 33, 473, 177)
GUICtrlSetBkColor(-1, $bgcolor)
GUICtrlCreateLabel("Commands and Job file storage", 312, 145, 151, 17)
$Preferences_ComJobFileLocal    = GUICtrlCreateInput("", 312, 161, 449, 22)
$Preferences_ReportsFileLocal   = GUICtrlCreateInput("", 312, 81, 449, 22)
GUICtrlCreateLabel("Reports", 312, 65, 41, 17)
$Preferences_SettingsINIFileLoc = GUICtrlCreateInput("", 312, 121, 449, 22)
GUICtrlCreateLabel("Settings INI File", 312, 105, 78, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("IMPORT SETTINGS", 16, 305, 281, 113)
GUICtrlSetBkColor(-1, $bgcolor)
$Preferences_ImportFromComp     = GUICtrlCreateInput("", 184, 337, 100, 22)
GUICtrlCreateLabel("Import from computer", 184, 321, 103, 17)
$Preferences_B_Import           = GUICtrlCreateButton("IMPORT", 208, 377, 75, 25)
$Preferences_ImportADMPass      = GUICtrlCreateInput("", 24, 377, 150, 22)
GUICtrlCreateLabel("ADM Password", 24, 361, 77, 17)
$Preferences_ImportADMUsername  = GUICtrlCreateInput("", 24, 337, 150, 22)
GUICtrlCreateLabel("ADM Username", 24, 321, 79, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Group5", 304, 217, 473, 161)
GUICtrlSetBkColor(-1, $bgcolor)
$Preferences_TBD2               = GUICtrlCreateCheckbox("Future Use 1", 320, 249, 97, 17)
$Preferences_TBD1               = GUICtrlCreateCheckbox("Future Use 2", 320, 265, 97, 17)
$Preferences_TBD3               = GUICtrlCreateCheckbox("Future Use 3", 320, 281, 97, 17)
$Preferences_TBD4               = GUICtrlCreateCheckbox("Future Use 4", 320, 297, 97, 17)
$Preferences_TBD5               = GUICtrlCreateCheckbox("Future Use 5", 320, 313, 97, 17)
$Preferences_TBD6               = GUICtrlCreateCheckbox("Future Use 6", 320, 329, 97, 17)
$Preferences_B_SaveAll          = GUICtrlCreateButton("Save All", 704, 393, 75, 25)
$Preferences_B_Reset            = GUICtrlCreateButton("Reset", 624, 393, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#region "Diagnostics"
$T_Diags              = GUICtrlCreateTabItem("Diagnostics")
$T_Diags_B_StartDiags = GUICtrlCreateButton("Start Diags", 640, 265, 115, 25)
$Diags_Step1          = GUICtrlCreateLabel("Has Valid IP", 32, 105, 62, 17)
$Diags_Step2          = GUICtrlCreateLabel("Can reach domain", 32, 129, 90, 17)
$Diags_Step3          = GUICtrlCreateLabel("Can see computers ready for testing", 32, 153, 173, 17)
$Diags_Step4          = GUICtrlCreateLabel("Reports Path exists and is writeable", 32, 177, 171, 17)
$Diags_Step5          = GUICtrlCreateLabel("Settings Path exists and is writeable", 32, 201, 172, 17)
$Diags_Step6          = GUICtrlCreateLabel("Commands and Job file storage exists and is writeable", 32, 225, 256, 17)
$Diags_Step7          = GUICtrlCreateLabel("Local User Account with Admin Rights account is in good standing", 32, 249, 318, 17)
$Diags_Step8          = GUICtrlCreateLabel("Domain User Account with Admin Rights account is in good standing", 32, 273, 328, 17)
;$Label26             = GUICtrlCreateLabel("", 32, 257, 4, 4)
$Edit5                = GUICtrlCreateEdit("Edit5", 33, 297, 727, 113)
#region ### Bottom Area ###
GUICtrlCreateTabItem("")
GUICtrlCreateGroup("", 0, 432, 793, 137)
$CustCommand        = GUICtrlCreateInput("", 8, 536, 657, 21)
$Execute            = GUICtrlCreateButton("Execute", 672, 536, 99, 25)
GUICtrlCreateLabel("Custom Command", 8, 520, 89, 17)
$Macro1             = GUICtrlCreateButton("Macro1", 8, 448, 75, 25)
$Macro2             = GUICtrlCreateButton("Macro2", 88, 448, 75, 25)
$Macro3             = GUICtrlCreateButton("Macro3", 168, 448, 75, 25)
$Macro4             = GUICtrlCreateButton("Macro4", 248, 448, 75, 25)
$Macro5             = GUICtrlCreateButton("Macro5", 328, 448, 75, 25)
$Macro6             = GUICtrlCreateButton("Macro6", 8, 480, 75, 25)
$Macro7             = GUICtrlCreateButton("Macro7", 88, 480, 75, 25)
$Macro8             = GUICtrlCreateButton("Macro8", 168, 480, 75, 25)
$Macro9             = GUICtrlCreateButton("Macro9", 248, 480, 75, 25)
$Macro10            = GUICtrlCreateButton("Macro10", 328, 480, 75, 25)
GUICtrlSetTip($Macro1 , $ToolMacro1, "Macro 1", 1, 1)
GUICtrlSetTip($Macro2 , $ToolMacro1, "Macro 2", 1, 1)
GUICtrlSetTip($Macro3 , $ToolMacro1, "Macro 3", 1, 1)
GUICtrlSetTip($Macro4 , $ToolMacro1, "Macro 4", 1, 1)
GUICtrlSetTip($Macro5 , $ToolMacro1, "Macro 5", 1, 1)
GUICtrlSetTip($Macro6 , $ToolMacro1, "Macro 6", 1, 1)
GUICtrlSetTip($Macro7 , $ToolMacro1, "Macro 7", 1, 1)
GUICtrlSetTip($Macro8 , $ToolMacro1, "Macro 8", 1, 1)
GUICtrlSetTip($Macro9 , $ToolMacro1, "Macro 9", 1, 1)
GUICtrlSetTip($Macro10, $ToolMacro1, "Macro 010", 1, 1)
LoadToolTips()
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("Custom Command", 420, 448, 357, 81)
$MachList           = GUICtrlCreateEdit("", 800, 24, 305, 545)
GUICtrlSetData(-1, "")
$Console            = GUICtrlCreateEdit("", 0, 600, 1105, 97)
GUICtrlSetData(-1, "console")
$_B_SaveConsole     = GUICtrlCreateButton("Save", 0, 576, 75, 17)
$_B_ClearConsole    = GUICtrlCreateButton("Clear", 80, 576, 75, 17)
;$ButtonForLaterUse = GUICtrlCreateButton("Save", 160, 576, 75, 17)
GUICtrlSetState($T_RunJob, $GUI_SHOW)
GUISetState(@SW_SHOW)
#endregion GUI
Global $Currenttab = GUICtrlRead($Tabs)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Macro1
            If _IsPressed("11", $dll) Then
                SetMacro(1)
            Else
                Macro(1)
            EndIf
        Case $Macro2
            If _IsPressed("11", $dll) Then
                SetMacro(2)
            Else
                Macro(2)
            EndIf
        Case $Macro3
            If _IsPressed("11", $dll) Then
                SetMacro(3)
            Else
                Macro(3)
            EndIf
        Case $Macro4
            If _IsPressed("11", $dll) Then
                SetMacro(4)
            Else
                Macro(4)
            EndIf
        Case $Macro5
            If _IsPressed("11", $dll) Then
                SetMacro(5)
            Else
                Macro(5)
            EndIf
        Case $Macro6
            If _IsPressed("11", $dll) Then
                SetMacro(6)
            Else
                Macro(6)
            EndIf
        Case $Macro7
            If _IsPressed("11", $dll) Then
                SetMacro(7)
            Else
                Macro(7)
            EndIf
        Case $Macro8
            If _IsPressed("11", $dll) Then
                SetMacro(8)
            Else
                Macro(8)
            EndIf
        Case $Macro9
            If _IsPressed("11", $dll) Then
                SetMacro(9)
            Else
                Macro(9)
            EndIf
        Case $Macro10
            If _IsPressed("11", $dll) Then
                SetMacro(10)
            Else
                Macro(10)
            EndIf
            ; TAB Switch Stuff
        Case $Currenttab <> GUICtrlRead($Tabs)
            $Currenttab = GUICtrlRead($Tabs)
            If GUICtrlRead($Tabs) <> 0 Then ; If tab is not Run Job then
                ;
                WinSetState($RunJob_Jobs, "", @SW_HIDE)
            Else
                ;
                WinSetState($RunJob_Jobs, "", @SW_SHOW)
            EndIf
            If GUICtrlRead($Tabs) <> 1 Then ; If tab is not Job Builder then
                ;
            Else
                ;
            EndIf
            If GUICtrlRead($Tabs) <> 2 Then ; If tab is not Command List then
                ;
            Else
                ;
            EndIf
            If GUICtrlRead($Tabs) <> 3 Then ; If tab is not Results then
                ;
            Else
                ;
            EndIf
            If GUICtrlRead($Tabs) <> 4 Then ; If tab is not Compare Reports then
                ;
            Else
                ;
            EndIf
            If GUICtrlRead($Tabs) <> 5 Then ; If tab is not Preferences then
                ;
            Else
                ;
            EndIf
            If GUICtrlRead($Tabs) <> 6 Then ; If tab is not Diagnostics then
                ;
            Else
                ;
            EndIf
    EndSwitch
WEnd
Func SetMacro($whichone)
    #cs
        $minigui = GUICreate("Edit Macro " & $whichone, 434, 229, 192, 114)
        GUISetBkColor(0xF0F0F0)
        $macnameset = GUICtrlCreateInput("", 16, 30, 153, 21)
        GUICtrlSetLimit($macnameset, 12, 0)
        GUICtrlCreateLabel("Macro Name", 16, 12, 65, 17)
        $canc = GUICtrlCreateButton("Close", 252, 192, 75, 25)
        $apply = GUICtrlCreateButton("Apply", 340, 192, 75, 25)
        $clearm = GUICtrlCreateButton("Clear Macro", 8, 192, 75, 25)
        $MacLocBu = GUICtrlCreateCombo("", 59, 77, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "4|7|11|15|17|19|52")
        $MacLocFl = GUICtrlCreateCombo("", 201, 77, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "1|2|3")
        $MacLocSi = GUICtrlCreateCombo("", 335, 77, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "Left|Right")
        $MacLocAr = GUICtrlCreateCombo("", 59, 119, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10")
        $MacLocUn = GUICtrlCreateCombo("", 201, 119, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "0|1|2|3|4|5|6|7|8|9|10")
        $MacLocSh = GUICtrlCreateCombo("", 335, 119, 85, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
        GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10")
        GUICtrlCreateLabel("Building:", 13, 77, 45, 20, $SS_RIGHT)
        GUICtrlCreateLabel("Floor:", 159, 77, 37, 20, $SS_RIGHT)
        GUICtrlCreateLabel("Side:", 293, 77, 37, 20, $SS_RIGHT)
        GUICtrlCreateLabel("Area:", 21, 119, 37, 20, $SS_RIGHT)
        GUICtrlCreateLabel("Unit:", 159, 119, 37, 20, $SS_RIGHT)
        GUICtrlCreateLabel("Shelf:", 301, 119, 29, 20, $SS_RIGHT)
        $Label1 = GUICtrlCreateLabel("EDIT MACRO " & $whichone, 224, 10, 170, 36)
        GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
        GUICtrlSetColor(-1, 0x000000)
    #ce
    #region ### START Koda GUI section ### Form=
    $minigui = GUICreate("Edit Macro", 549, 210, 245, 200)
    GUISetBkColor(0xF0F0F0)
    $macnameset = GUICtrlCreateInput("", 16, 62, 153, 21)
    GUICtrlCreateLabel("Command Name", 16, 44, 145, 17)
    $canc = GUICtrlCreateButton("Close", 372, 160, 75, 25)
    $apply = GUICtrlCreateButton("Apply", 460, 160, 75, 25)
    $clearm = GUICtrlCreateButton("Clear Macro", 200, 160, 75, 25)
    $MacLocAr = GUICtrlCreateCombo("", 19, 167, 149, 120, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
    $Label1 = GUICtrlCreateLabel("EDIT MACRO", 328, 10, 170, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0x000000)
    $Input1 = GUICtrlCreateInput("", 184, 62, 353, 21)
    GUICtrlCreateLabel("Command String", 184, 44, 145, 17)
    GUICtrlCreateLabel("Pre-defined Command", 16, 148, 145, 17)
    $Label2 = GUICtrlCreateLabel("OR", 48, 98, 58, 36)
    GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0x000000)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    $isitthere = RegRead($RegLoc & "Mac" & $whichone, "name")
    If $isitthere <> "" Then
        If RegRead($RegLoc & "Mac" & $whichone, "Name")     Then GUICtrlSetData($macnameset, RegRead($RegLoc & "Mac" & $whichone, "Name"))
        If RegRead($RegLoc & "Mac" & $whichone, "Building") Then GUICtrlSetData($MacLocBu, RegRead($RegLoc & "Mac" & $whichone, "Building"))
        If RegRead($RegLoc & "Mac" & $whichone, "Floor")    Then GUICtrlSetData($MacLocFl, RegRead($RegLoc & "Mac" & $whichone, "Floor"))
        If RegRead($RegLoc & "Mac" & $whichone, "Side")     Then GUICtrlSetData($MacLocSi, RegRead($RegLoc & "Mac" & $whichone, "Side"))
        If RegRead($RegLoc & "Mac" & $whichone, "Area")     Then GUICtrlSetData($MacLocAr, RegRead($RegLoc & "Mac" & $whichone, "Area"))
        If RegRead($RegLoc & "Mac" & $whichone, "Unit")     Then GUICtrlSetData($MacLocUn, RegRead($RegLoc & "Mac" & $whichone, "Unit"))
        If RegRead($RegLoc & "Mac" & $whichone, "Shelf")    Then GUICtrlSetData($MacLocSh, RegRead($RegLoc & "Mac" & $whichone, "Shelf"))
    EndIf
    GUISetState(@SW_SHOW)
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($minigui)
                ExitLoop
                Return
            Case $canc
                GUIDelete($minigui)
                ExitLoop
                Return
            Case $apply
                If GUICtrlRead($macnameset) = "" Then
                    MsgBox(0, "Forget Something?", "You have to give your macro a name. This is the name that will appear on the button of the macro.", 5)
                Else
                    RegWrite($RegLoc & "Mac" & $whichone, "Name", "REG_SZ", GUICtrlRead($macnameset))
                    If GUICtrlRead($MacLocBu) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Building", "REG_SZ", GUICtrlRead($MacLocBu))
                    If GUICtrlRead($MacLocFl) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Floor", "REG_SZ", GUICtrlRead($MacLocFl))
                    If GUICtrlRead($MacLocSi) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Side", "REG_SZ", GUICtrlRead($MacLocSi))
                    If GUICtrlRead($MacLocAr) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Area", "REG_SZ", GUICtrlRead($MacLocAr))
                    If GUICtrlRead($MacLocUn) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Unit", "REG_SZ", GUICtrlRead($MacLocUn))
                    If GUICtrlRead($MacLocSh) <> "" Then RegWrite($RegLoc & "Mac" & $whichone, "Shelf", "REG_SZ", GUICtrlRead($MacLocSh))
                    UpdateMacros()
                    GUIDelete($minigui)
                    ExitLoop
                EndIf
            Case $clearm
                Dim $iMsgBoxAnswerMac
                $iMsgBoxAnswerMac = MsgBox(262419, "Are you SURE?", "Are you SURE you wish to clear this macro?", 15)
                Select
                    Case $iMsgBoxAnswerMac = 6 ;Yes
                        RegDelete($RegLoc & "Mac" & $whichone)
                        UpdateMacros()
                        MsgBox(0, "", "Macro Cleared")
                        UpdateMacros()
                    Case $iMsgBoxAnswerMac = 7 ;No
                        MsgBox(0, "", "OK, nothing has been deleted", 5)
                        UpdateMacros()
                    Case $iMsgBoxAnswerMac = 2 ;Cancel
                        ;UpdateMacros()
                    Case $iMsgBoxAnswerMac = -1 ;Timeout
                        MsgBox(0, "", "OK, nothing has been deleted", 5)
                        UpdateMacros()
                EndSelect
        EndSwitch
    WEnd
EndFunc   ;==>SetMacro
Func Macro($num)
EndFunc   ;==>Macro
Func UpdateMacros()
    If RegRead($RegLoc & "Mac1", "Name") Then
        GUICtrlSetData($Macro1, RegRead($RegLoc & "Mac1", "Name"))
        GUICtrlSetStyle($Macro1, $GUI_SS_DEFAULT_BUTTON)
    Else
        GUICtrlSetData($Macro1, "Macro 1")
        GUICtrlSetStyle($Macro1, $BS_FLAT)
    EndIf
    LoadToolTips()
EndFunc   ;==>UpdateMacros
Func LoadToolTips()
    $isitthere1 = RegRead($RegLoc & "Mac1", "name")
    If $isitthere1 <> "" Then
        $isitthere1data = ""
        If RegRead($RegLoc & "Mac1", "Building") Then $isitthere1data &= "Building: " & RegRead($RegLoc & "Mac1", "Building") & @CRLF
        If RegRead($RegLoc & "Mac1", "Floor") Then $isitthere1data &= "Floor: " & RegRead($RegLoc & "Mac1", "Floor") & @CRLF
        GUICtrlSetTip($Macro1, $isitthere1data, "Macro 1", 1, 1)
    Else
        GUICtrlSetTip($Macro1, "This macro is not defined yet." & @CRLF & "Hold CTRL and click on it" & @CRLF & "to bind a command to it.", "Macro 1", 1, 1)
    EndIf
EndFunc   ;==>LoadToolTips
Func Hide($Rachel)
    If GUICtrlGetState($Rachel) = 80 Then GUICtrlSetState($Rachel, 96)
EndFunc   ;==>Hide
Func Show($Rachel)
    If GUICtrlGetState($Rachel) = 96 Then GUICtrlSetState($Rachel, 80)
EndFunc   ;==>Show

Thanks in advance!

SWAT Server 1.au3


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites



Just a question, why use the UDF to create the LIstView when the native function doesn't have this issue?


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

Share this post


Link to post
Share on other sites

Just a question, why use the UDF to create the LIstView when the native function doesn't have this issue?

 

I understand the native function does not have as many features as the UDF like sorting, checkbox,  and other options, so I was hoping to use the UDF Version, even though it is harder to work with.


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

Kovacic,

I understand the native function does not have as many features as the UDF like sorting, checkbox, and other options

You understand wrongly. ;)

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

I personally never use the UDF to create a listview, I use the native version and just get the handle of the Listview so I can still use the UDF for the rest of the functions in it. I've had a lot of issues with the UDF version that I haven't had with the built-in function. Maybe one of these days I'll try to figure out what the problem with the UDF create is. ;)


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

Share this post


Link to post
Share on other sites

Kovacic,

You understand wrongly. ;)

M23

I was hoping I did, because although I mastered using the UDF version in another application I wrote, I would rather not have to go through all that again, so in this case, I am happy I misunderstood lol.

 

I personally never use the UDF to create a listview, I use the native version and just get the handle of the Listview so I can still use the UDF for the rest of the functions in it. I've had a lot of issues with the UDF version that I haven't had with the built-in function. Maybe one of these days I'll try to figure out what the problem with the UDF create is. ;)

 

I am going to take your advice and try working with the native ListView and just play with the styles to see what I come up with. It is a pain to have to active the particular listview you will be using when you want to use it (speaking about the UDF version).

 

I appreciate the feedback and will try the native list view and come back later if i have any Q.

 Thanks!


C0d3 is P0etry( ͡° ͜ʖ ͡°)

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

  • Similar Content

    • fopetesl
      By fopetesl
      OK, still learning SOLVED! $WS_EX_COMPOSITED hides buttons?
      I've read, run examples but cannot show action buttons in tabs in a GUI.
      I've run the GUICtrlCreateTabItem function example and, of course, it works.
      Mine doesn't:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MenuConstants.au3> #include <TabConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate("My GUI Tab", @DesktopWidth * 1, @DesktopHeight * 1, 0, 0,-1, $WS_EX_COMPOSITED) $hTab = GUICtrlCreateTab(10, 10, 640, 480,$TCS_HOTTRACK) ; Create tabitems ;For $i = 0 To 2 GUICtrlCreateTabItem(" Scan Sample ") ; $idButton1 = GUICtrlCreateButton("Button " & 0, 20 + (0 * 100), 40 + (0 * 50), 80, 30) ; $idButton1 = GUICtrlCreateButton("00", 20, 50, 80, 30) GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) GUICtrlCreateTabItem(" Database ") GUICtrlCreateButton("Button " & 1, 20 + (1 * 100), 40 + (1 * 50), 80, 30) GUICtrlCreateTabItem(" Software ") GUICtrlCreateButton("Button " & 2, 20 + (2 * 100), 40 + (2 * 50), 80, 30) ;Next ; Close Tab definiton GUICtrlCreateTabItem("") ; Set the color of the label control. ; GUICtrlSetColor($idButton1, 0x002E7A) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd It just shows:
      whatever I try.  So I've missed, again?, that I do not have the focus?
       
    • Miliardsto
      By Miliardsto
      Hello I got problem with my form cause i got some buttons, labels, inputs and now i want organize this in tabs.
      There is a problem, when i put new tab this tab is on bottom and this is above my buttons or button is show on whole form , not only in one tab.
      How to deal with it
    • masterlink950
      By masterlink950
      Hello, First off, I want to say that I very much appreciate the hard work that people put in to replying on these forums and helping newbs. I've gotten 99% of my answers through google, forum searches, and documentation.
      Okay, so. I'm actually sure this has been asked before, but I wasn't able to find anything and I'm having some difficulty.
      I want to delete tabs in a control with a middle click (or specifically, detect when a tab has been middle-clicked).
      Initially I was going to try to use GUIGetCursorInfo along with checking for a middle-click, the problem is, when the cursor is over a tab, it simply returns the ID of the whole control (I'm using the native tab functionality).
      If I can avoid it, I REALLY don't want to manually check coordinates of tabs when the middle mouse is clicked, as tabs are going to be generated dynamically (anywhere from one to infinity tabs if the user lets things get out of hand), and the window I'm using will be resizable (thus having to run checks if a tab is out of view, etc), but I can if I have no other choice.
       
      So basically, Is there either 1: a simple native/UDF way to detect middle-click on tabs, 2: a way to get GUIGetCursorInfo give the control ID of the tab itself instead of the control, or 3: something I haven't thought of all together?
      Thanks in advance!
    • Rfsvieira
      By Rfsvieira
      Hello, i have read the wiki for tabs, and search in some sites for code ideas, and get what i have now
      1st i have the broblem that wen i choice one iten the image appears in all tabs
      i resolved that with the -----GUISwitch($GUI, $TabID)----
      Now i have a problema that wen i choice the iten the image doesn t appear only if i change tab i go back to the tab
      Any idea?
      #include <GuiConstantsEx.au3> #include <GuiTab.au3> Global $dir =("FULL\") $GUI = GUICreate("Test Script", 500, 500) $hTab = GUICtrlCreateTab(5, 10, 500, 450) $Tab1 = GUICtrlCreateTabItem("Tab1") $Tab2 = GUICtrlCreateTabItem("Tab2") $Pic1 = GUICtrlCreatePic("", 15, 202, 25, 25); pic coordenades and size $Pic2 = GUICtrlCreatePic("", 15, 234, 25, 25) $Pic3 = GUICtrlCreatePic("", 15, 264, 25, 25) $Combo3 = GUICtrlCreateCombo("Corpo", 47, 268, 65, 25); combobox place GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo3) ; getdata funcion $Combo2 = GUICtrlCreateCombo("Corpo", 47, 238, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo2) $Combo1 = GUICtrlCreateCombo("Corpo", 47, 206, 65, 25) GUICtrlSetFont(-1, 8, 400, 0, "Arial") jcorpo($combo1) $Tab3 = GUICtrlCreateTabItem("Tab3") ;GUICtrlSetState($Tab2, $GUI_SHOW); tessting code GUICtrlCreateTabItem("") $Switch_Button = GUICtrlCreateButton("Switch Next", 20, 470, 80, 20) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $combo1 GUISwitch($GUI, $Tab2) img1($combo1, $Pic1, 15, 202) GUISwitch($GUI) case $combo2 img1($combo2, $pic2, 15, 234) Case $combo3 img1($combo3, $Pic3, 15, 264) Case $GUI_EVENT_CLOSE Exit Case $Switch_Button $iCurrent_TabIndex = _GUICtrlTab_GetCurSel($hTab) $iNext_TabIndex = $iCurrent_TabIndex Switch $iCurrent_TabIndex Case 0, 1 $iNext_TabIndex += 1 Case 2 $iNext_TabIndex = 0 EndSwitch _GUICtrlTab_SetCurSel($hTab, $iNext_TabIndex) EndSwitch WEnd Func img1($var, $imp, $x1, $y1) ; $Read = GUICtrlRead($var) If $Read = "A" Then $imp = GUICtrlCreatePic($dir & "A.bmp", $x1, $y1, 25, 25) EndIf If $Read = "B" Then $imp = GUICtrlCreatePic($dir & "B.bmp", $x1, $y1, 25, 25) EndIf If $Read = "C" Then $imp = GUICtrlCreatePic($dir & "C.bmp", $x1, $y1, 25, 25) EndIf If $Read = "" Then $imp = GUICtrlCreatePic($dir & "", $x1, $y1, 25, 25) ;Else ; $imp = GUICtrlCreatePic($dir & "null.bmp", $x1, $y1, 25, 25) EndIf EndFunc Func jcorpo($varcomb) GUICtrlSetData($varcomb, "A|B|C") EndFunc func _exit() Exit EndFunc  
    • corz
      By corz
      #include <GuiTab.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> AutoItSetOption("GUIOnEventMode", 1) global $tabspace, $tabspace_opt, $old_tab, $tabs[3] = [2], $opt_tabs[6] = [5] global $width = 400, $height = 300, $x = -1, $y = -1 $ExampleGUI = GUICreate("example", $width, $height, $x, $y, BitOr($WS_CAPTION, $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_SIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, "DoExit", $ExampleGUI) $opt_gui = GUICreate("opt_child", $width, $height-50, 3, 5, BitOR($WS_CHILD, $WS_TABSTOP), -1, $ExampleGUI) $tabspace_opt = GUICtrlCreateTab(3, 2, $width-20, $height-20, BitOr($TCS_BUTTONS, $TCS_FLATBUTTONS, $TCS_TOOLTIPS, $TCS_HOTTRACK, $WS_CHILD, $WS_TABSTOP)) $opt_tabs[1] = GUICtrlCreateTabItem(" Option 1 ") $opt_tabs[2] = GUICtrlCreateTabItem(" Option 2 ") $opt_tabs[3] = GUICtrlCreateTabItem(" Option 3 ") $opt_tabs[4] = GUICtrlCreateTabItem(" Option 4 ") $opt_tabs[5] = GUICtrlCreateTabItem(" Option 5 ") GUICtrlCreateTabItem("") GUISwitch($ExampleGUI) $tabspace = GUICtrlCreateTab(3, 2, $width, $height-5, BitOr($TCS_BOTTOM, $TCS_BUTTONS, $TCS_TOOLTIPS, $TCS_HOTTRACK, $WS_TABSTOP)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) $tabs[1] = GUICtrlCreateTabItem(" Main Tab.. ") $tabs[2] = GUICtrlCreateTabItem(" Options.. ") GUICtrlCreateTabItem("") GUICtrlSetTip($tabs[1], " Tip for the main tab.. ") GUICtrlSetTip($tabs[2], " Tip for the options tab.. ") GUICtrlSetTip($opt_tabs[1], " Tip for options tab 1.. ") GUICtrlSetTip($opt_tabs[2], " Tip for options tab 2.. ") GUICtrlSetTip($opt_tabs[3], " Tip for options tab 3.. ") GUICtrlSetTip($opt_tabs[4], " Tip for options tab 4.. ") GUICtrlSetTip($opt_tabs[5], " Tip for options tab 5.. ") GUISetState(@SW_SHOW, $ExampleGUI) while true local $new_tab = GUICtrlSendMsg($tabspace, $TCM_GETCURSEL, 0, 0) if $new_tab <> $old_tab then if $new_tab = 1 then GUISetState(@SW_SHOW, $opt_gui) else GUISetState(@SW_HIDE, $opt_gui) GUISetState(@SW_SHOW, $ExampleGUI) endif $old_tab = $new_tab endif Sleep(100) wend func DoExit() exit endfunc  
      As you can see, the tooltip for the options tabs 1 & 2 appear when hovering your pointer over the main two tabs.
      Am I doing something wrong? Or is this a bug?
       
      ;o) Cor