Jump to content
YuChan

List item in directory

Recommended Posts

Hello,

I want create on combo list with file in this directory

I have this:

Func _loadListeConfig()
    ; Liste tous les fichiers et sous-répertoires du dossier bureau en utilisant les paramètres par défaut.
    Local $aFileList = _FileListToArray(@ScriptDir, "trajet")
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Le chemin était incorrect.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "Aucun fichier trouvé.")
        Exit
    EndIf
    _ArrayDisplay($aFileList, "$aFileList")

    $myCombo = GUICtrlCreateCombo("Dialog", 280, 150, 200, 408)
    $txt = ""
    For $i = 1 to $aFileList[0]
    $txt &= $aFileList[$i] & "|"
    Next
    GUICtrlSetData($myCombo, $aFileList)

EndFunc   ;==>Example

But my combo box is empty.

Please can you help me ?

Share this post


Link to post
Share on other sites
3 hours ago, YuChan said:

But my combo box is empty.

Quick example for illustration :

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <Array.au3>
#include <File.au3>

Local $iGuiMsg, $OkButton, $myCombo, $sCombo
GUICreate("", 600, 300, -1, -1, 0x00010000)

$sCombo = _LoadListeConfig()
$myCombo = GUICtrlCreateCombo("", 20, 50, 560, 40)
GUICtrlSetData($myCombo, $sCombo)

$OkButton = GUICtrlCreateButton("Close", 200, 200, 200, 40)

GUISetState()
While 1
    $iGuiMsg = GUIGetMsg()
    Select
        Case $iGuiMsg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $iGuiMsg = $OkButton
            ExitLoop
    EndSelect
WEnd
GUIDelete()


Func _LoadListeConfig()
    ; Lists all files and subdirectories in the desktop folder using the default settings.
    Local $sText = ""
    Local $aFileList = _FileListToArrayRec(@ScriptDir, "*", $FLTAR_FILESFOLDERS, $FLTAR_NORECUR , Default, $FLTAR_FULLPATH)
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "The path was incorrect.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "No files found.")
        Exit
    EndIf
    _ArrayDisplay($aFileList, "$aFileList")

    For $i = 1 To $aFileList[0]
        $sText &= $aFileList[$i] & "|"
    Next

    Return($sText)
EndFunc   ;==>_LoadListeConfig

 

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...