PcExpert Posted February 4, 2009 Author Share Posted February 4, 2009 The first thing I noticed is that when you go to Groepen -> Toevoegen it returns the checkboxes with texts like ' vk1' , 'vk2' and so on. It needs to have texts like 'vak1' (value read from vakken.ini'. Could you fix that for me? Thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2009 Moderators Share Posted February 4, 2009 PcExpert,[rant]As one of my American colleagues used to say: "Do you want fries with that?"!!!In your image in Post #9 you had "vk1" etc next to your checkboxes!!!!!!!!And in your own script in Func addvak() you have the line: $new_vak1 = "vk" & GUICtrlRead($vak1) & "," !!!!!!!!So that is what I gave you!!!!!!![/rant]Seriously, as far as I can see all you have to do is use the "Search - Replace" menu in SciTE. Make sure you have the "Match Whole Word Only" box ticked and then replace "vk" with "vak". I have looked at your script and it should hit all the right places.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...
PcExpert Posted February 4, 2009 Author Share Posted February 4, 2009 I'm sorry, my mistake. I solved that part now and everything seems to work OK now. Thanks for your help coding this Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2009 Moderators Share Posted February 4, 2009 PcExpert, A pleasure. 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...
PcExpert Posted February 7, 2009 Author Share Posted February 7, 2009 (edited) Its me again, I'm currently improving all my gui's. There are to many checkboxes being generated. I have this code: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Global $CheckBox[31] Global $top = 50 Global $left = 15 Global $count = 0 Global $vtotal = 1 Opt("GUIOnEventMode", 1) $Gui_addgroup = GUICreate("MyGUI", 450, 275) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit") GUICtrlCreateLabel("Groepnaam:", 10, 10) $newgroup = GUICtrlCreateInput("", 80, 7, 100, 20) GUICtrlCreateGroup("Vakken", 10, 30, 430, 243) GUICtrlCreateButton("OK", 350, 235, 80, 35) GUICtrlSetOnEvent(-1, "GroupAddOK") GUISetState(@SW_SHOW, $Gui_addgroup) $vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To 5 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) $count += 1 $top += 20 Next $top = 50 For $i = 6 To 10 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) $count += 1 $top += 20 Next $top = 50 For $i = 11 To 15 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) $count += 1 $top += 20 Next $top = 50 For $i = 16 To 20 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 240, $top, 50, 20) $count += 1 $top += 20 Next $top = 50 For $i = 21 To 25 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 305, $top, 50, 20) $count += 1 $top += 20 Next $top = 50 For $i = 26 To 30 $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 370, $top, 50, 20) $count += 1 $top += 20 Next $vakken = StringReplace($vakken, "vk", "") $vakken_array = StringSplit($vakken, ",") For $i = 1 To 30 If $vakken_array[$i] <> "" Then GUICtrlSetData($CheckBox[$i], $vakken_array[$i]) EndIf Next EndIf While 1 Sleep(100) WEnd Func On_Exit() ConsoleWrite("Exiting" & @CRLF) Exit EndFunc Func GroupAddOK() If GUICtrlRead($newgroup) = Not "" Then $newgr2 = "" For $f = $CheckBox[1] To $CheckBox[30] $newgr1 = BitAND(GUICtrlRead($f), $GUI_CHECKED) If $newgr1 = $GUI_CHECKED Then $newgr2 &= GUICtrlRead($f, 1) & "," EndIf Next $ini_File = @ScriptDir & "\groepen\" & GUICtrlRead($newgroup) & ".ini" IniWrite($ini_file, "algemeen", "vakken", $newgr2) Else MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vul AUB een geldige naam in voor de groep") EndIf EndFunc ;==>GroupAddOK This code works, but it creates to many checkboxes. It has to generate the same number of checkboxes as there are professions. Vakken.ini looks like this: [algemeen] vakken=vkAGF,vkSTM,vkRTF,vkMNE,vkBBK,vkCBO,vkDST,vkMEN,vkPWH,vk,vk,vk,vk,vk,vk,vk,vk,vk,vk,vk,vk,vk, vk,vk,vk,vk,vk,vk,vk,vk, as you can see there are 9 professions right now, for each profession it needs to create a checkbox. The problem is that it generates checkboxes also if there's no valid profession (only 'vk'). There's a maximum of 30 professions which all CAN be used, but not nessasary need to be, so the ' vk,vk,vk' entry's should stay. I just dont know how to limit the generated checkboxes so that they only create a checkbox when there's something behind the 'vk' entry. Could you guys please help me out again? Thanks! P.S. This code also changes the checkboxnames to names from the ini, finally. Edited February 7, 2009 by PcExpert Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 7, 2009 Moderators Share Posted February 7, 2009 PcExpert,Create $vakken_array before the checkboxes and the test the length of each element.If StringLen($vakken_array[$i]) > 2 Then $CheckBox[$i] = GUICtrlCreateCheckbox(.....Be careful to adjust the counts when you test the checkboxes in function GroupAddOK() - at the moment you just run from 1 to 30. Perhaps a counter to get the number of checkboxes you actually create:; Before creating the checkboxes $iCount = 0 ... If StringLen($vakken_array[$i]) > 2 Then $CheckBox[$i] = GUICtrlCreateCheckbox(..... $iCount += 1 EndifM23 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...
PcExpert Posted February 7, 2009 Author Share Posted February 7, 2009 You're great! Thanks again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2009 Moderators Share Posted February 8, 2009 PcExpert, The multiple loops we came up with to create your checkboxes has been offending my programming sensibilities since the moment I saw them on screen! A little bit of thought has (I hope!) come up with a rather more elegant solution:For $i = 1 To 30 $CheckBox[$i] = GUICtrlCreateCheckbox"vk" & $i, 45 + 65 * Int(($i - 1)/5), 50 + 20 * Mod($i - 1, 5), 50, 20) $count += 1 NextYou can now delete all reference to $top.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...
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