Jump to content
Sign in to follow this  
johnmcloud

ListView_Create save output

Recommended Posts

johnmcloud

Hi guys, i have some problem to make the output of a _GUICtrlListView_Create:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
$Number = 0
_Main()
Func _Main()
Local $GUI, $hImage
$GUI = GUICreate("(UDF Created) ListView Create", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
_GUICtrlListView_AddItem($hListView, "1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Item1", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Item2", 2)
_GUICtrlListView_AddItem($hListView, "2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Item1 - Line 2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Item1 - Line 2", 2)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

I have make an script like this:

$List = FileOpen(@WorkingDir & "\test.txt", 2)
  $Number_items = _GUICtrlListView_GetItemCount($hListView)
   For $i = 0 To $Number_items - 1 Step +1
    $read = _GUICtrlListView_GetItemTextArray($hListView, $i)
    _FileWriteFromArray($List, $read, 1)
   Next
  FileClose($List)

On the txt the layout is:

1
Item1
Item2
2
Item1 - Line 2
Item1 - Line 2

But i want a layout like:

1 - Item1 - Item2
2 - Item1 - Line 2 - Item1 - Line 2

Some advice?

Thanks

Share this post


Link to post
Share on other sites
spudw2k

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  

  • Similar Content

    • jvds
      By jvds
      Hi all,
      is there a way to disable a listview created with _GUICtrlListView_Create?
      GUICtrlSetState($g_hListView,@SW_DISABLE) does not work, reading arround the form give me the idea that I need to use winapi but I have no clue how to disable it that way
      thanks
      #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> $hGUI=GUICreate("ImageList Create", 400, 300) $g_hListView = _GUICtrlListView_Create($hGUI, "", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlListView_AddColumn($g_hListView, "a", 120) _GUICtrlListView_AddColumn($g_hListView, "b", 120) _GUICtrlListView_AddItem($g_hListView, "1", 0) _GUICtrlListView_AddItem($g_hListView, "2", 1) _GUICtrlListView_AddSubItem($g_hListView, 0, "3", 1) _GUICtrlListView_AddSubItem($g_hListView, 1, "4", 1) ;Not Working GUICtrlSetState($g_hListView,@SW_DISABLE) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete()  
    • NearValue
      By NearValue
      Having problems with GUICtrlCreateListView() and _GUICtrlListView_Create(). 
       
      But if I use either of them, sorting (by clicking the header to arrange the list) using GUICtrlCreateListView() it works. But for _GUICtrlListView_Create() it won't. Same thing happens for editing the list using GUICtrlCreateListView().
       
      ;GUICtrlCreateListView() sorting works. Editing fails.
       

      #include <GuiEdit.au3> #include <GUIListViewEx_Mod.au3> #include <GuiImageList.au3> #include <String.au3> #include <Misc.au3> #include <File.au3> #include <Timers.au3> #include <WinAPI.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GUIListBox.au3> #include <ListviewConstants.au3>   Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0   Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT) Global $aIcons[3] = [0, 3, 6], $font = "Gill Sans"   Global $hGUI = GUICreate("TEST CLIENT", 1600, 900)   $hListView = GUICtrlCreateListView("TEST1|TEST2|TEST3", 5, 100, 938, 500)   ;$hListView = _GUICtrlListView_Create($hGUI, "TEST1|TEST2|TEST3", 5, 100, 938, 500, $LVS_REPORT, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_BORDERSELECT, $LVS_EX_ONECLICKACTIVATE, $LVS_EDITLABELS,$WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE))   $hNM_DBCLK = GUICtrlCreateDummy() $hEN_KILLFOCUS = GUICtrlCreateDummy()   _AddRow($hListView, "1|A|NAME1", $aIcons, 1) _AddRow($hListView, "2|B|NAME2", $aIcons, 2) _AddRow($hListView, "3|C|NAME3", $aIcons, 3)   GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")   GUISetState(@SW_SHOW, $hGUI)   _GUICtrlListView_RegisterSortCallBack($hListView)   While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit         case $hNM_DBCLK             Start_EditingLV()         Case $hEN_KILLFOCUS             End_EditingLV() Case $hListView _GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))     EndSwitch WEnd   _GUICtrlListView_UnRegisterSortCallBack($hListView) GUIDelete()   ;===============================================================   Func _AddRow($hWnd, $sItem, $aIcons, $iPlus = 0) Local $aItem = StringSplit($sItem, "|") Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $aIcons[0] + $iPlus, _GUICtrlListView_GetItemCount($hWnd) + 99999) _GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)   For $x = 2 To $aItem[0] _GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $aIcons[$x - 1] + $iPlus) _GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE) Next EndFunc   ;==>_AddRow     Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $tNMHDR, $hWndFrom, $iCode   $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code")   Switch $hWndFrom Case $hListView Switch $iCode Case $NM_DBLCLK                     GUICtrlSendToDummy($hNM_DBCLK) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc   Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)     Local $stRect = DllStructCreate("int;int;int;int")   DllStructSetData($stRect, 1, $nLeft) DllStructSetData($stRect, 2, $nTop) DllStructSetData($stRect, 3, $nRight) DllStructSetData($stRect, 4, $nBottom)   DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush) EndFunc   Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iCode = BitShift($wParam, 16)   Switch $lParam Case $hEdit Switch $iCode Case $EN_KILLFOCUS                     GUICtrlSendToDummy($hEN_KILLFOCUS) EndSwitch EndSwitch   Return $GUI_RUNDEFMSG EndFunc   Func Start_EditingLV()     ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView)))       Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)     Local $hRect = ControlGetPos($hGUI, "", $hListView)       If ($aHit[0] <> -1) And ($aHit[1] = 0) Then         $Item = $aHit[0]         $SubItem = 0         Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)     ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then         $Item = $aHit[0]         $SubItem = $aHit[1]         Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem) ;dldl     Else         Return $GUI_RUNDEFMSG     EndIf       Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)     Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)     $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + ($hRect[0] + 3), $aRect[1] + $hRect[1], $iLen + 10, 17, $Style)       _GUICtrlEdit_SetSel($hEdit, 0, -1)     _WinAPI_SetFocus($hEdit)     $hDC = _WinAPI_GetWindowDC($hEdit)     $hBrush = _WinAPI_CreateSolidBrush(0x0000FF)     FrameRect($hDC, 0,0, $iLen + 10 , 17, $hBrush)     HotKeySet("{ENTER}", "End_EditingLV")   EndFunc   Func End_EditingLV()     Local $iText = _GUICtrlEdit_GetText($hEdit)     _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)     _WinAPI_DeleteObject($hBrush)     _WinAPI_ReleaseDC($hEdit, $hDC)     _WinAPI_DestroyWindow($hEdit)     ControlEnable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView)))       $Item = -1     $SubItem = 0     HotKeySet("{ENTER}") EndFunc    
    • Kovacic
      By Kovacic
      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
    • adom
      By adom
      Hello,
      I need help in the following case:
      I have a main GIU and 20 or more Childs. I want to put a ListView on each Child. 
      For generating the Childs and the ListViews I use a FOR NEXT.
      The issue:
      20 or more Childs will be created. But only 16 ListViews will be placed in the first 16 Childs. 
      I tried to reach the childs above the 16th instance with ControlMove to proof to have the right Handle. The Handle works.
      So I suppose that _GUICtrlListView_Create(HWND, ..) doesnt manage HDNDs for Childs 16 + correct.
      Does anyone has an Idea what is there the problem?
      Greetings Andrew
      _____code snippets below:
      Creating Child===================================== Local $modElem_window   Local $left_Next = 0 Local $title   For $i = 1 To 20   $modElem_window = 0   $title = String($i)   ;~ If $i = 17 Then $title = -1 ;~ If $i = 18 Then $title = -2     $modElem_window = GUICreate($title, 50, 300, $left_Next, 10, BitOr($WS_POPUP, $WS_BORDER)) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUISetBkColor(0x9900D1)           Creating List===================================== Local $sHeaderText = "Done|CMD|RUN-Mode|ACK 2|ACK 1"   $List_CMDs_Modul_1 = _GUICtrlListView_Create($modElem_window, $sHeaderText, -1, -1, -1, -1) _GUICtrlListView_SetExtendedListViewStyle($List_CMDs_Modul_1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP, $LVS_EX_SUBITEMIMAGES, $LVS_EX_DOUBLEBUFFER)) ; $LVS_EX_SUBITEMIMAGES GUICtrlSetResizing(-1, $GUI_DOCKALL)   _GUICtrlListView_SetColumnOrder($List_CMDs_Modul_1, "1|2|3|4|0")  
×