cueclub Posted March 28, 2010 Share Posted March 28, 2010 (edited) I'm back. again i know. Ok here is what i have written. expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) example() Func example() Local $tab, $msg Local $aTabBox[10][32], $aButton[10] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1 GUICreate("Test", 575, 600, 5, 200, 1, $WS_EX_TOPMOST) GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) ; Create Tab control $tab = GUICtrlCreateTab(8, 55, 550, 500) ; Create 10 tabs For $i = 0 To 9 ; Create tab GUICtrlCreateTabItem("Input " & $i + 1) ; Create inputs in this tab For $j = 0 To 7 ; Do not Step 1 - that is the default value <<<<<<<<<<<<<<<<<<<<<<<<<<<<< 2 GUICtrlCreateLabel(" # " & $j + 1, 15 + (60 * $j), 85, 100) $aTabBox[$i][$j] = GUICtrlCreateInput("", 15 + (60 * $j), 105, 50, 30) Next for $h = 0 to 7 GUICtrlCreateLabel(" # " & $h + 9 , 15 + (60 * $h), 135, 100) $aTabBox[$i][$h + 8] = GUICtrlCreateInput("", 15 + (60 * $h), 155, 50, 30) ; <<<<<<<<<<<<<<<< 3 Next FOR $K = 0 TO 7 GUICtrlCreateLabel(" # " & $K + 17 , 15 + (60 * $K), 185 , 100) $aTabBox[$i][$K + 16] = GUICtrlCreateInput("", 15 + (60 * $K), 215, 50, 30) ; <<<<<<<<<<<<<<<< 3 Next; Create button in this tab For $l = 0 to 7 GUICtrlCreateLabel(" # " & $l + 25 , 15 + (60 * $l), 245 , 100) $aTabBox[$i][$l + 24] = GUICtrlCreateInput("", 15 + (60 * $l), 265, 50, 30) ; <<<<<<<<<<<<<<<< 3 Next $aButton[$i] = GUICtrlCreateButton("Save", 40, 325, 100) Next ; end tabitem definition GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect ; Check buttons For $i = 0 To 9 If $msg = $aButton[$i] Then ; If button pressed, write ini For $j = 0 To 31 IniWrite(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $j + 1, GUICtrlRead($aTabBox[$i][$j])) Next ;exit Do you really want to Exit here? ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 4 EndIf Next WEnd EndFunc ;==>Example ok what i want to do is have the values already in the ini file to appear in the input boxes as a default number. I have been trying to use this $def = Iniread(@ScriptDir & "\settings.ini", "input " & $i + 1 & " test # ", $j + 1, GUICtrlRead($aTabBox[$i])) And would put the $def where the default input would go to. And as shocked as I am it isn't working as it would with a normal input box and ini file. Do I have to seperate it to get the key from each position? Not sure if i want to type out (32 inireads) * ( input spaces ) Would make for quite a mess. Any ideas? Thanks Cue Edited April 2, 2010 by cueclub Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2010 Moderators Share Posted March 29, 2010 cueclub, You can make the code really compact and not have to type so much if you do it this way: ; Put this at the top of the Function to save rewriting it a few times Local $sIniFile = @ScriptDir & "\settings.ini" ; And then change your tab creation code: ; Create 10 tabs For $i = 0 To 9 ; Create tab GUICtrlCreateTabItem("Input " & $i + 1) ; Create inputs in this tab ; Each line will be 8 inputs, so increae the count by 8 for each line For $j = 0 To 24 Step 8 ; Now create this line - Int($j / 8) gives us the linenumber to increase the y coordinate For $k = 0 To 7 GUICtrlCreateLabel(" # " & $j + $k + 1, 15 + (60 * $k), 85 + (50 * Int($j / 8)), 100) ; Read the current ini value - default is blank $Def = IniRead($sIniFile, "input " & $i + 1 & " test # ", $j + $k + 1, "") ; And create the input with that default value in place $aTabBox[$i][$j + $k] = GUICtrlCreateInput($Def, 15 + (60 * $k), 105 + (50 * Int($j / 8)), 50, 30) Next Next $aButton[$i] = GUICtrlCreateButton("Save", 40, 325, 100) Next ; end tabitem definition GUICtrlCreateTabItem("") ; And obviously your IniWrite line becomes: IniWrite($sIniFile, "input " & $i + 1 & " test # ", $j + 1, GUICtrlRead($aTabBox[$i][$j])) Loops can get really clever and very compact if you think about how to manage the various indices. But best keep those buckets handy! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
cueclub Posted March 30, 2010 Author Share Posted March 30, 2010 (edited) M23 Using your example above, I have ran into a problem. ( I started to think ). Here is what I have Local $sIniFile = @ScriptDir & "\settings.ini", $aTabBox, $aButton For $i = 0 To 9 ; Create tab GUICtrlCreateTabItem("Input " & $i + 1) For $j = 0 To 24 Step 8 Int($j / 8) ; For $k = 0 To 7 GUICtrlCreateLabel(" # " & $j + $k + 1, 15 + (60 * $k), 85 + (50 * Int($j / 8)), 100) ; Read the current ini value - default is blank $Def = IniRead($sIniFile, "input " & $i + 1 & " test # ", $j + $k + 1, "") ; And create the input with that default value in place $aTabBox[$i][$j + $k] = GUICtrlCreateInput($Def, 15 + (60 * $k), 105 + (50 * Int($j / 8)), 50, 30) Next Next $aButton[$i] = GUICtrlCreateButton("Save", 40, 325, 100) Next GUICtrlCreateTabItem("") IniWrite($sIniFile, "input " & $i + 1 & " test # ", $j + 1, GUICtrlRead($aTabBox[$i][$j])) However when I run it it throws this at me: C:\Users\Main\Desktop\time delay test.au3 (33) : ==> Subscript used with non-Array variable.: $aTabBox[$i][$j + $k] = GUICtrlCreateInput($Def, 15 + (60 * $k), 105 + (50 * Int($j / 8)), 50, 30) $aTabBox^ ERROR So I replied with this And now I'm doing this ( they should really disable my smiley's ) Any ideas on what for ME to look at to change. Thanks Cue Edited March 30, 2010 by cueclub Link to comment Share on other sites More sharing options...
cueclub Posted March 31, 2010 Author Share Posted March 31, 2010 think I might just do it the old drawn out way till I figure it out ty ty Cue Link to comment Share on other sites More sharing options...
cueclub Posted April 2, 2010 Author Share Posted April 2, 2010 ok I am lost. Anyone else have any ideas? Would appreciate it. Thanks Cue Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2010 Moderators Share Posted April 3, 2010 cueclub,The error mesage is trying to tell you thet you need to define $aTabBox as an array - merely declaring the name is not enough. You would have received a similar error for $aButton as well if the code had got that far. Look at the script in your original post:Local $aTabBox[10][32], $aButton[10]and in your latest version:Local $sIniFile = @ScriptDir & "\settings.ini", $aTabBox, $aButtonSee the difference?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
cueclub Posted April 3, 2010 Author Share Posted April 3, 2010 (edited) no, no i don't Thank you for the reply. I had written it a different way also, and posted in general help section. But you have managed to start my weekend by reminding me that i don't know what I'm doing lol It's always something easy though isnt it. Just outside my range of thinking . It is working now by the way Thanks again M23 Cue Edited April 3, 2010 by cueclub 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