Sign in to follow this  
Followers 0
InunoTaishou

Gui List?

5 posts in this topic

So there used to be a <illegal name on the autoit forum> that I used to use and i love how the GUI is setup for storing profiles and showing values in, what looks like, the gui list
 
I've tried GuiCtrlCreateListView(& Item) but it doesn't really match up. It sounds really picky, I know, but I like the coumn/row line seperation so it creates boxes

And then after that I need it so that while the GUI is active it keeps the first button (run) highlighted

I'm wanting to store a whole bunch of documents in it. Type the first few letters of the file name from the gui, Enter and it opens.

So it'd be something like

File name | path | Date modified | File extension (.pdf, .txt, etc)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
Global $var2,$var3,$var4,$var22,$var33,$var44,$var222,$var333,$var444
#Region ### START Koda GUI section ### Form=
$frmMain = GUICreate("Bot", 600, 400, 500, 197)
$grpFiles = GUICtrlCreateGroup("Scripts", 5, 50, 510, 155)
$lstFiles = GUICtrlCreateListView("File name | path | Date modified | File extension", 10, 66, 500, 100)
$file1 = GUICtrlCreateListViewItem("C:\Tests|" & $var2 & "|" & $var22 & $var222,$lstScripts)
$file2 = GUICtrlCreateListVIewItem("D:\Test|" & $var3 & "|" & $var33 & $var333,$lstScripts)
$file3 = GUICtrlCreateListViewItem("C:\Test|" & $var4 & "|" & $var44 & $var444,$lstScripts)
$open = GUICtrlCreateButton("Open", 10, 168, 75, 33)
$aFile = GUICtrlCreateButton("Add File", 95, 168, 75, 33)
$tabLog = GUICtrlCreateTab(10, 207, 510, 155)
GUICtrlCreateTabItem("Common Log")
GUISetState(@SW_SHOW,$frmMain)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
            Exit
        Case $open
            _open()
        Case $aFile
            _aFile()
    EndSwitch
WEnd

post-75010-0-01096800-1403589377_thumb.p

Share this post


Link to post
Share on other sites



InunoTaishou,

Is there actually a question in there or are we supposed to read your mind as to exactly what you want? :huh:

Some possible solutions to the implicit questions in your post:

 

- 1. A ListView does give you "the column/row line separation so it creates boxes" look that you desire - particularly if you use the $LVS_EX_GRIDLINES style.

- 2. Using the $BS_DEFPUSHBUTTON style on the "Run" button should help with the "while the GUI is active it keeps the first button (run) highlighted" problem - and the "[press] Enter and it opens" one too.

- 3. As for "Type the first few letters of the file name from the gui" - I imagine you will have to search the ListView using _GUICtrlListView_GetItemText and then highlight the first/best match as you add characters to the search input.

I hope this is of some help. If you want to be more specific about exactly what you want to do, we can probably offer better focused help. ;)

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

Here is correction of your GUI part GUICtrlCreateListViewItem()

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

Global $var2,$var3,$var4,$var22,$var33,$var44,$var222,$var333,$var444

$var3 = 'D:\Test\'
$var33 = '2013-12-31'
$var333 = 'DOC'

#Region ### START Koda GUI section ### Form=
$frmMain = GUICreate("Bot", 600, 400, 500, 197)
$grpFiles = GUICtrlCreateGroup("Scripts", 5, 50, 510, 155)
$lstFiles = GUICtrlCreateListView("File name|path|Date modified|File extension", 10, 66, 500, 100)
$file1 = GUICtrlCreateListViewItem("file1.txt|C:\Tests\|2014-06-24|TXT",$lstFiles)
$file2 = GUICtrlCreateListVIewItem("file2.DOC|" & $var3 & "|" & $var33 & "|" & $var333,$lstFiles)
$open = GUICtrlCreateButton("Open", 10, 168, 75, 33)
$aFile = GUICtrlCreateButton("Add File", 95, 168, 75, 33)
$tabLog = GUICtrlCreateTab(10, 207, 510, 155)
GUICtrlCreateTabItem("Common Log")
GUISetState(@SW_SHOW,$frmMain)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
            Exit
;~         Case $open
;~             _open()
;~         Case $aFile
;~             _aFile()
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Sorry if I wasn't specific enough, it was really late, but you completely nailed it Melba :)

And thanks Zedna, I was just using the random path to see what the List looks like, if I want to add 500 files I don't want 500 $var's lol I'll be using _GUICtrlListView_AddArray and then probably something with iniwrite to save the select file information

One more question while I'm here, which is better/faster/more efficient for buttons: OnEventMode or Select...Case?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <GuiButton.au3>

#Region ### START Koda GUI section ### Form=
$frmMain = GUICreate("Bot", 600, 400, 500, 197)
$grpFiles = GUICtrlCreateGroup("", 5, 50, 510, 155)
$lstFiles = GUICtrlCreateListView("", 10, 66, 500, 100,$LVS_EX_Gridlines)
_GUICtrlListView_SetExtendedListViewStyle($lstFiles, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_Gridlines))
$open = _GUICtrlButton_Create($frmMain,"Open", 10, 168, 75, 33,$BS_DEFPUSHBUTTON)
_GUICtrlListView_AddColumn($lstFiles,"File name",100)
_GUICtrlListView_AddColumn($lstFiles,"Path",150)
_GUICtrlListView_AddColumn($lstFiles,"Date Modified",100)
_GUICtrlListView_AddColumn($lstFiles,"Extension",75)
$aFile = _GUICtrlButton_Create($frmMain,"Add File", 95, 168, 75, 33)
$tabLog = GUICtrlCreateTab(10, 207, 510, 155)
GUICtrlCreateTabItem("Common Log")
GUISetState(@SW_SHOW,$frmMain)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
            Exit
        Case $open
        Case $aFile
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

InunoTaishou,

Nice to see the crystal ball is in good working order! :D

As to which AutoIt mode is "better" - this is completely subjective and depends on the particular script. If you search you will find a number of threads where this has been discussed at length, but personally I tend to use MessageLoop mode unless there is a very good reason not to do so. And before you ask, the Interrupting a running function tutorial in the Wiki shows a very good one! ;)

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

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