Jump to content

Recommended Posts

Posted

Hi ! .

I was trying to create a gui that would make X tabsitems (one tab per folder in the script directory)

and also, in each tab, would list *.gif files located in that folder.

I've tried to do it like that...

CODE
$t = "Recherche expérimentale du Pouf"

$x = 400

$y = 600

$gui = GuiCreate($t, $x,$y,-1,-1,BitOR($WS_EX_TOOLWINDOW,$WS_TILEDWINDOW))

GUISetState (@SW_SHOW)

$result=0

$tab = _FileListToArray(@ScriptDir,"*",2)

GUICtrlCreateTab(0,0,$x,$y)

for $i = 1 to $tab[0]

$tab[$i] = GUICtrlCreateTabItem($tab[$i])

$emoticone = _FileListToArray($tab[$i],"*",1)

For $j = 1 To $emoticone[0]

Guictrlcreatebutton("",0,0,20,20)

Next

Next

While 1

$msg = GUIGetMsg()

Switch $msg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

Wend

But had no success in it. It seems that my "nested array" can't work. Any idea to solve that ? ...

Meanwhile, i'll continue to search everywhere a solution.

Thanks for your help, if it comes :P

Posted

What you did wrong was, after creating your $tab array of folders, you then re-assign each element to a control handle:

$tab[$i] = GUICtrlCreateTabItem($tab[$i])

The $tab array now no longer holds folder locations/names.

I did it like this:

#include <GUIConstants.au3>
#include <File.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

GUICreate("Form1", 401, 342)
GUISetOnEvent($GUI_EVENT_CLOSE,"close")

$Dir = @ScriptDir & "\" ; make sure dir ends with \
$Folders = _FileListToArray($Dir,"*", 2)

GUICtrlCreateTab(10,10,380,320)

For $i = 1 To (UBound($Folders) - 1)
    GUICtrlCreateTabItem($Folders[$i])
    $Files = _FileListToArray($Dir & $Folders[$i],"*.gif",1) ;remove .gif to see ALL files
    $Files = _ArrayToString($Files,"|",1)
    $list = GUICtrlCreateList("",20,40,360,280)
    GUICtrlSetData(-1,$Files)
Next

GUICtrlCreateTabItem("") ;important - finishes off the tab controls

GUISetState(@SW_SHOW)
While 1
    Sleep(100)
WEnd

Func close()
    Exit
EndFunc

note: I've used on-event mode here. Adapt it yourself to suit your needs.

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

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...