Jump to content

My ListView inside multiple Tab item is possible ?


Recommended Posts

Helo peoples :)

 

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$hGui = GUICreate ("Multiple List", 500 , 550 )
$hTab = GUICtrlCreateTab ( 10 , 10 ,480,530 )
GUICtrlCreateTabItem("1")
$hCheckBox1 = GUICtrlCreateCheckbox ( "$hCheckBox1" , 20 , 50 ,200 , 20)
$Console = GUICtrlCreateListView("-----------Historique-----------", 20 , 230 , 200 , 200 )
_GUICtrlListView_SetColumnWidth ($Console , 0 , 800 )
$hTab2 = GUICtrlCreateTabItem("2")
;GUICtrlSetState($Console,$GUI_SHOW)Failed
GUISetState (@SW_SHOW , $hGui )

While (1)
   Sleep(100)
   $msg = GUIGetMsg ()
      Switch $msg
         Case $GUI_EVENT_CLOSE
            _Exit ()
      EndSwitch
WEnd

Func _Exit ()
   Exit
EndFunc

Is it possible to have :

"$Console" In $hTab & $hTab2 ?

 

Thanks :)

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

It s becose I need tabs in my tool. I will have 4-5 tabs. Then dev more tabs later probably.

 

And I am doing a console in each tab to trace what's going on.

Then if i add a line in the console like

_GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Copied|Failed|"&repOfTheFile )

I would like to have the line in all console, I know whitch tab made the item becose of the tag "Copied" and if an other tab is adding item:

_GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Moved|Failed|"&repOfTheFile )

Again an other tag and I would like to see it also in all console.

(And the purpose is becose : )

I mean actually if i add a tab. and If i want to log everything. I have to add $Console(Number) In each precedent finished Tab. I would like to dodge this. I dont want to go back in my code again.

_GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Moved|Failed|"&repOfTheFile )
;NewTab made So i have to add this in all tab
_GUICtrlListView_AddItem($Console1,"|"&$kO&"/"&$gB&"|Moved|Failed|"&repOfTheFile )
;NewTab made So i have to add this in all tab
_GUICtrlListView_AddItem($Console2,"|"&$kO&"/"&$gB&"|Moved|Failed|"&repOfTheFile )

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

You can only have a control in one tab at a time, but there's nothing stopping you from creating duplicates of that control for the other tabs, and updating them all at the same time.

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

Link to comment
Share on other sites

12 minutes ago, BrewManNH said:

You can only have a control in one tab at a time, but there's nothing stopping you from creating duplicates of that control for the other tabs, and updating them all at the same time.

I tryed that before asking. @BrewManNH

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$kO=0
$gB=0
$repOfTheFile="C:/"

$hGui = GUICreate ("Multiple List", 500 , 550 )
$hTab = GUICtrlCreateTab ( 10 , 10 ,480,530 )
GUICtrlCreateTabItem("1")
$hCheckBox1 = GUICtrlCreateCheckbox ( "$hCheckBox1" , 20 , 50 ,200 , 20)
$Console = GUICtrlCreateListView("-----------Historique-----------", 20 , 230 , 200 , 200 )
_GUICtrlListView_SetColumnWidth ($Console , 0 , 800 )
$hTab2 = GUICtrlCreateTabItem("2")
$hCheckBox2 = GUICtrlCreateCheckbox ( "$hCheckBox2" , 20 , 50 ,200 , 20)
$Console = GUICtrlCreateListView("-----------Historique-----------", 20 , 230 , 200 , 200 )
GUISetState (@SW_SHOW , $hGui )

While (1)
   Sleep(100)
   $iCheck = _IsChecked ($hCheckBox1)
   $iCheck2 = _IsChecked ($hCheckBox2)
      If $iCheck = True Or $iCheck2 = True Then
         _un ()
         _deux ()
         ;_Debug ()
      EndIf
   $msg = GUIGetMsg ()
      Switch $msg
         Case $GUI_EVENT_CLOSE
            _Exit ()
      EndSwitch
WEnd

Func _un ()
   If $iCheck = True Then
      _GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Copied|Failed|"&$repOfTheFile )
      GUICtrlSetState($hCheckBox1,$GUI_UNCHECKED)
   EndIf
EndFunc

Func _deux ()
   If $iCheck2 = True Then
      _GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Moved|Failed|"&$repOfTheFile )
      GUICtrlSetState($hCheckBox2,$GUI_UNCHECKED)
   EndIf
EndFunc

Func _Exit ()
   Exit
EndFunc

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc

Only tab two updated.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

57 minutes ago, caramen said:

I would like to dodge this. I dont want to go back in my code again.

You can't dodge it.  But you can make it so you don't have to go back in your code if you add a new tab.  So instead of naming your consoles $Console1, $Console2, $Console3, etc.  Simply put them into an array of consoles.  Create a single function that will update all the consoles based on the ubound of the array.

Link to comment
Share on other sites

Ohhhh good idea! Thanks!

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Why such a complication ? wouldn't something like this be *much* easier ?

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$kO=0
$gB=0
$repOfTheFile="C:/"

$hGui = GUICreate ("Multiple List", 500 , 550 )
$hTab = GUICtrlCreateTab ( 10 , 10 ,480, 200 )
GUICtrlCreateTabItem("1")
$hCheckBox1 = GUICtrlCreateCheckbox ( "$hCheckBox1" , 20 , 50 ,200 , 20)
$hTab2 = GUICtrlCreateTabItem("2")
$hCheckBox2 = GUICtrlCreateCheckbox ( "$hCheckBox2" , 20 , 50 ,200 , 20)
GUICtrlCreateTabItem("")
$Console = GUICtrlCreateListView("-----------Historique-----------", 20 , 230 , 200 , 200 )
GUISetState (@SW_SHOW , $hGui )

While (1)
   Sleep(10)
   $msg = GUIGetMsg()
      Switch $msg
         Case $hCheckBox1
              If _IsChecked ($hCheckBox1) Then _un ()
         Case $hCheckBox2
              If _IsChecked ($hCheckBox2) Then _deux ()
         Case $GUI_EVENT_CLOSE
            _Exit ()
      EndSwitch
WEnd

Func _un ()
      _GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Copied|Failed|"&$repOfTheFile )
      GUICtrlSetState($hCheckBox1,$GUI_UNCHECKED)
EndFunc

Func _deux ()
      _GUICtrlListView_AddItem($Console,"|"&$kO&"/"&$gB&"|Moved|Failed|"&$repOfTheFile )
      GUICtrlSetState($hCheckBox2,$GUI_UNCHECKED)
EndFunc

Func _Exit ()
   Exit
EndFunc

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc

 

Link to comment
Share on other sites

@mikell Thanks for suggestion it was reproducer ;) 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...