cueclub Posted April 3, 2010 Share Posted April 3, 2010 Ok here is the problem. I am creating a 10 tab window. With 31 boxes on each tab. No problems so far. hehe When i try to get it to write to the ini, doesnt work. When I try and get it to read the INI for the defaults. haha Doesnt work. I have been at this for a couple of days now. Here is what I have. expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) example() Func example() Local $tab, $msg, $def1, $def2, $def3, $def4 Local $aTabBox[10][32], $aButton[10] GUICreate("Test", 575, 600, 5, 200, 1, $WS_EX_TOPMOST) GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab = GUICtrlCreateTab(8, 55, 550, 500) For $i = 0 To 9 GUICtrlCreateTabItem("Input " & $i + 1) For $j = 0 To 7 $def1 = Iniread(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $j + 1, ($aTabBox[$i][$j])) GUICtrlCreateLabel(" # " & $j + 1, 15 + (60 * $j), 85, 100) $aTabBox[$i][$j] = GUICtrlCreateInput($def1, 15 + (60 * $j), 105, 50, 30) Next for $h = 0 to 7 $def2 = Iniread(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $h + 1, ($aTabBox[$i][$h])) GUICtrlCreateLabel(" # " & $h + 9 , 15 + (60 * $h), 135, 100) $aTabBox[$i][$h + 8] = GUICtrlCreateInput($def2, 15 + (60 * $h), 155, 50, 30) Next FOR $K = 0 TO 7 $def3 = Iniread(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $k + 1, ($aTabBox[$i][$k])) GUICtrlCreateLabel(" # " & $K + 17 , 15 + (60 * $K), 185 , 100) $aTabBox[$i][$K + 16] = GUICtrlCreateInput($def3, 15 + (60 * $K), 215, 50, 30) Next For $l = 0 to 7 $def4 = Iniread(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $l + 1, ($aTabBox[$i][$l])) GUICtrlCreateLabel(" # " & $l + 25 , 15 + (60 * $l), 245 , 100) $aTabBox[$i][$l + 24] = GUICtrlCreateInput($def4, 15 + (60 * $l), 265, 50, 30) Next $aButton[$i] = GUICtrlCreateButton("Save", 40, 325, 100) Next GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect For $i = 0 To 9 If $msg = $aButton[$i] Then For $j = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $j + 1, GUICtrlRead($aTabBox[$i][$j])) Next For $h= 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $h + 1, GUICtrlRead($aTabBox[$i][$h])) Next For $k = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $k + 1, GUICtrlRead($aTabBox[$i][$k])) Next For $l= 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $l + 1, GUICtrlRead($aTabBox[$i][$l])) Next EndIf Next WEnd EndFunc When I just do it with 1 line, it works great. So I decided to enter a couple of more Lines. Thats where i messed up. I started to think. okay does anyone have any ideas on this, before i try to push a pen through my eye? lol j/k btw. thanks in advance Cue Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 3, 2010 Share Posted April 3, 2010 I think you confused yourself by try to mix 0-based and 1-based numbering. Also, each row on a tab needs a separate section, or separate key name, not just "test #". In addition, using the array of control IDs for default values doesn't seem helpful. This works: expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) example() Func example() Local $tab, $msg, $def1, $def2, $def3, $def4 Local $aTabBox[10][32], $aButton[10] GUICreate("Test", 575, 600) $tab = GUICtrlCreateTab(8, 55, 550, 500) For $i = 0 To 9 GUICtrlCreateTabItem("Input " & $i) For $j = 0 To 7 $def1 = IniRead(@ScriptDir & "\settings.ini", "input " & $i & " test #0", $j, $i & "_" & 0 & "_" & $j) GUICtrlCreateLabel(" # " & $j, 15 + (65 * $j), 85, 100) $aTabBox[$i][$j] = GUICtrlCreateInput($def1, 15 + (65 * $j), 105, 55, 30) Next For $h = 0 To 7 $def2 = IniRead(@ScriptDir & "\settings.ini", "input " & $i & " test #1", $h, $i & "_" & 1 & "_" & $h) GUICtrlCreateLabel(" # " & $h + 8, 15 + (65 * $h), 145, 100) $aTabBox[$i][$h + 8] = GUICtrlCreateInput($def2, 15 + (65 * $h), 165, 55, 30) Next For $K = 0 To 7 $def3 = IniRead(@ScriptDir & "\settings.ini", "input " & $i & " test #2", $K, $i & "_" & 2 & "_" & $K) GUICtrlCreateLabel(" # " & $K + 16, 15 + (65 * $K), 205, 100) $aTabBox[$i][$K + 16] = GUICtrlCreateInput($def3, 15 + (65 * $K), 235, 55, 30) Next For $l = 0 To 7 $def4 = IniRead(@ScriptDir & "\settings.ini", "input " & $i & " test #3", $l, $i & "_" & 3 & "_" & $l) GUICtrlCreateLabel(" # " & $l + 24, 15 + (65 * $l), 275, 100) $aTabBox[$i][$l + 24] = GUICtrlCreateInput($def4, 15 + (65 * $l), 295, 55, 30) Next $aButton[$i] = GUICtrlCreateButton("Save", 40, 365, 100) Next GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $aButton[0], $aButton[1], $aButton[2], $aButton[3], $aButton[4], $aButton[5], $aButton[6], $aButton[7], $aButton[8], $aButton[9] For $i = 0 To 9 If $msg = $aButton[$i] Then For $j = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i & " test #0", $j, GUICtrlRead($aTabBox[$i][$j])) Next For $h = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i & " test #1", $h, GUICtrlRead($aTabBox[$i][$h])) Next For $K = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i & " test #2", $K, GUICtrlRead($aTabBox[$i][$K])) Next For $l = 0 To 7 IniWrite(@ScriptDir & "\settings.ini", "input " & $i & " test #3", $l, GUICtrlRead($aTabBox[$i][$l])) Next ExitLoop EndIf Next EndSwitch WEnd EndFunc ;==>example That has a separate section for each row of each tab. You could easily modify it to only have a separate section for each tab, with a unique key name for each row/column. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
cueclub Posted April 3, 2010 Author Share Posted April 3, 2010 thank you for the reply. I will keep working with it. Cue 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