Basti756 Posted August 2, 2009 Share Posted August 2, 2009 Hi, I'm trying to create a GUI with several labels on it. The labels should be created dynamically, depeding on the key/value pairs of a section of an INI file. Here's the code I got so far: #include <GUIConstantsEx.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) $x = @DesktopWidth $y = @DesktopHeight $a = 15 GUICreate("",$x,$y,0,0) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $aUserNames = IniReadSection ("users.ini","users") _ArrayDisplay ($aUserNames) For $i=1 To $aUserNames[0][0] For $a=15 To $y-200 Step 15 GUICtrlCreateLabel ($aUserNames[$i][1], 10,$a,100,30) Next Next GUISetState (@SW_SHOW) While 1 Sleep (1000) Wend Func CLOSEClicked() Exit EndFunc The problem I'm having is that only the last value of the INI file is displayed - even more than . I bet I did something like that once before but I can't remember how. So if somebody could point me to the right direction please? >_< Thanks in advance Link to comment Share on other sites More sharing options...
Valuater Posted August 2, 2009 Share Posted August 2, 2009 (edited) Not Tested... #include <GUIConstantsEx.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) $x = @DesktopWidth $y = @DesktopHeight $a = 10 $b = 15 GUICreate("", $x, $y, 0, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $aUserNames = IniReadSection("users.ini", "users") _ArrayDisplay($aUserNames) For $i = 1 To $aUserNames[0][0] GUICtrlCreateLabel($aUserNames[$i][1], $a, $b, 100, 15) $b += 15 If $b >= ($y - 15) Then $a += 120 $b = 15 EndIf Next GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd Func CLOSEClicked() Exit EndFunc ;==>CLOSEClicked 8) Edited August 2, 2009 by Valuater Link to comment Share on other sites More sharing options...
Basti756 Posted August 2, 2009 Author Share Posted August 2, 2009 Thanks a lot. You made my day >_ Link to comment Share on other sites More sharing options...
Valuater Posted August 2, 2009 Share Posted August 2, 2009 Welcome!! You were gone so long, I didn't think you were going to see the code I wrote. 8) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now