Jump to content
Sign in to follow this  
shea851

Seeking help with GUICtrlCreateList stuff

Recommended Posts

shea851

I'm having a few problems with the first GUI i'm making. I'm using some UDF's included with the most recent version of AutoIt and i've looked/tried dozens of things from the CHM help file but have had no luck.

1. When I select multiple items in the "FileOpenDialogue" screen, then hit OK, it adds them all on 1 line using "|" to seperate the names of the files. I would like the items to go on different lines with different indexs. I'm thinking I need to use @CRLF or something but unsure if that's even right and even more unsure where to put it in my code.

2. I'd like to be able to drag and drop into the "GUICtrlCreateList". Each file that will be dropped there should go on it's own line and have it's own index.

Can anyone assist? Thanks in advance.

#include <GUIConstants.au3>
#Include <GuiList.au3>

#Region ### START Koda GUI section ### Form=H:\Koda\Forms\test3.kxf

$Form1_1_1 = GUICreate(" .doc -> .html -> .chm", 449, 394, 221, 161)
GUISetFont(8, 400, 0, "Tahoma")

$Group1 = GUICtrlCreateGroup(".doc files to be converted:  ", 0, 8, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$List1 = GUICtrlCreateList("", 7, 31, 393, 121)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileAddDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 31, 36, 36, $BS_BITMAP)
GUICtrlSetImage($FileAddDialogueDOC, "images\wordfoldergrey.bmp")
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileRemoveDialogueDOC = GUICtrlCreateButton("(Not allowed)", 405, 71, 36, 36, $BS_BITMAP)
GUICtrlSetImage($FileRemoveDialogueDOC, "images\xfoldergrey.bmp")
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$ConvertToHTML = GUICtrlCreateButton("Convert to HTML", 7, 157, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup(".html documents to be imported: ", 0, 208, 448, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$List2 = GUICtrlCreateList("", 7, 231, 393, 121)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileAddDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 231, 36, 36, $BS_BITMAP)
GUICtrlSetImage($FileAddDialogueHTML, "images\iefoldergrey.bmp")
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$FileRemoveDialogueHTML = GUICtrlCreateButton("(Not allowed)", 405, 271, 36, 36, $BS_BITMAP)
GUICtrlSetImage($FileRemoveDialogueHTML, "images\xfoldergrey.bmp")
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

$ImportToCHM = GUICtrlCreateButton("Import to CHM", 7, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)

$CompileCHM = GUICtrlCreateButton("Compile CHM", 111, 357, 97, 29, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
;   Select
;    Case $nMsg = $ConvertToHTML
;    html()
;   EndSelect
    
    If $nMsg = $FileAddDialogueDOC Then
        $SelectedDoc = FileOpenDialog("Choose doc file...",@DesktopCommonDir,"All (*.doc)", 1 + 4)
        _GUICtrlListAddItem ($List1, $SelectedDoc)
    Else
    EndIf
    
    If $nMsg = $FileRemoveDialogueDoc Then
        $SelectedDocs = _GUICtrlListSelectedIndex ($List1)
        _GUICtrlListDeleteItem ($List1, $SelectedDocs)
    Else
    EndIf
WEnd

Share this post


Link to post
Share on other sites
shea851

Thanks for reply ^^

Well, that's a step in the right direction. Let's say I try and add 3 files to the list, it fills in line one with the path to directory, and then line two, three, and four with the file names.

My goal is to have each line with the full path+file name. Still looking through the CHM.. there's soooo many functions and udfs I gots no idea which to use for this. It's almost like i've got to store the path as a variable and then the file name as a variable seperately then make it "dirpathvar & filenamevar". But I don't see how to do that with just one FileOpenDialogue ...

If that makes sense.. probably not. :)

Edited by shea851

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  

×