NinjaMaster Posted June 18, 2008 Share Posted June 18, 2008 hi everyone. I am a complete newbie with AU3 and was wondering the following. I have been tasked with creating a software install system to help streamline ops at work. Desktop analysts will choose from a menu system depending on which office they are situated at and also which deptaretment they are installing for. I have been playing about with some code and will attach what I have to date. What I was hoping for was that the software list to be created depending on what office/dept is picked. At the moment it is just some dummy data I've added as checkbox list. I've played about with _GUICtrlComboBox_GetDroppedState but it only seems to check the state of the dropdown at that particular time. When I add a loop in the GUI just shuts. Hopefully that makes some kind fof sense cause I'm not sure it does even for me! expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Comment=Proof of concept #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_File_Add=bds.jpg #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <GUIComboBox.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) Global $msg, $cancelbutton Master_GUI() CompleteSWList() OfficeDropDown() DeptDropDown() DeptSWInstall() ;Create master GUI Func Master_GUI() Local $Installbutton GUICreate("Software Installer", 700, 450) GUICtrlCreateLabel("", 0, 375, 700, 2, $SS_SUNKEN) GUICtrlCreateTreeView(-1,376,700,74);Create white space at bottom of GUI. $Installbutton = GUICtrlCreateButton("&Install", 435, 285, 70, 20) $cancelbutton = GUICtrlCreateButton("&Cancel", 525, 285, 70, 20) EndFunc ;Create Treeview of complete software list func CompleteSWList() Local $treeview, $SW1, $SW2, $SW3, $SW4 ;Creates box round treeview GUICtrlCreateLabel("Complete software list", 10, 60) $treeview = GUICtrlCreateTreeView(10, 75, 300, 300, BitOR($TVS_CHECKBOXES, $TVS_HASBUTTONS, $TVS_DISABLEDRAGDROP), $WS_EX_CLIENTEDGE) ;Creates each SW vendor branch $SW1 = GUICtrlCreateTreeViewItem("Software Vendor 1", $treeview) GUICtrlSetColor(-1, 0x0000C0) $SW2 = GUICtrlCreateTreeViewItem("Software Vendor 2", $treeview) GUICtrlSetColor(-1, 0x0000C0) $SW3 = GUICtrlCreateTreeViewItem("Software Vendor 3", $treeview) GUICtrlSetColor(-1, 0x0000C0) $SW4 = GUICtrlCreateTreeViewItem("Software Vendor 4", $treeview) GUICtrlSetColor(-1, 0x0000C0) ;List vendor 1 software GUICtrlCreateTreeViewItem("Software Package 1", $SW1) ;List vendor 2 software GUICtrlCreateTreeViewItem("Software Package 1", $SW2) GUICtrlCreateTreeViewItem("Software Package 2", $SW2) GUICtrlCreateTreeViewItem("Software Package 3", $SW2) GUICtrlCreateTreeViewItem("Software Package 4", $SW2) ;List vendor 3 software GUICtrlCreateTreeViewItem("Software Package 1", $SW3) GUICtrlCreateTreeViewItem("Software Package 2", $SW3) GUICtrlCreateTreeViewItem("Software Package 3", $SW3) ;List vendor 4 software GUICtrlCreateTreeViewItem("Software Package 1", $SW4) GUICtrlCreateTreeViewItem("Software Package 2", $SW4) GUICtrlCreateTreeViewItem("Software Package 3", $SW4) GUICtrlSetState($SW1, ($GUI_DEFBUTTON)) GUICtrlSetState($SW2, ($GUI_DEFBUTTON)) GUICtrlSetState($SW3, ($GUI_DEFBUTTON)) GUICtrlSetState($SW4, ($GUI_DEFBUTTON)) EndFunc Func OfficeDropDown() GUICtrlCreateLabel("Choose Office", 10, 8) GUICtrlCreateCombo("Office 1", 10, 20, 125); create first item GUICtrlSetData(-1, "Office 2|Office 3|Office 4|Office 5|", "Office 1"); add other item snd set a new default EndFunc Func DeptDropDown() GUICtrlCreateLabel("Choose Deptartment", 325, 8, 125) GUICtrlCreateCombo("Dept 1", 325, 20); create first item GUICtrlSetData(-1, "Dept 2|Dept 3|Dept 4|Dept 5|Dept 6|", "Dept 1"); add other item and set a new default EndFunc Func DeptSWInstall() GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 1",325, 75), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 2",325, 100), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 3",325, 125), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 4",325, 150), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 5",325, 175), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 6",325, 200), ($GUI_CHECKED)); Check the software boxes by default GUICtrlSetState(GUICtrlCreateCheckbox("Software Package 7",325, 225), ($GUI_CHECKED)); Check the software boxes by default EndFunc ;Checks that GUI has not been closed GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Link to comment Share on other sites More sharing options...
DjDeep00 Posted June 18, 2008 Share Posted June 18, 2008 @NinjaMaster... 1. You need to assign Control Variables like: $Dept_Combo=GUICtrlCreateCombo("Dept 1", 325, 20); create first item 2. After selecting combo values, add this code to read whats selected: Case $msg =$Dept_Combo MsgBox(4096,"",GUICtrlRead($Dept_Combo)) 3. Then after the user makes the selection repopulate the treeview with different packages. Link to comment Share on other sites More sharing options...
NinjaMaster Posted June 19, 2008 Author Share Posted June 19, 2008 Excellent thanks DjDeep00! This is all new to me so I'm pretty sure I'll be back for some morepointers. 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