kor Posted March 13, 2012 Share Posted March 13, 2012 (edited) Please see screen shots belowthis script is designed to be an end all be all for staff and student account creation, deletion, and moving within our school district. It does it's job amazingly well. However some new requirements means I need to modify some fields and change/extend the GUI a little bit and I figured now might be a good time to approach the layout entirely.The way the GUI is setup is a tabbed menu within a tabbed menu. the "student, staff" is the parent gui and the "move, delete, create" is a child gui of the parent. This was my first real attempt at making something more than just a script so I realize it might not be the most elegant.However I am wondering if anyone has any better suggestions for a simple layout GUI that will allow easy access to all 6 options for an account staff add delete move, student add delete move, while also being intuitive and maybe a little easier to work with the GUI code on the back end. The parent child gui stuff was kind of hard to learn and isn't real flexible.Without giving too much away for our internal stuff here is the GUI portion of the script to give everyone an idea as to what is going on behind the scenes.expandcollapse popupFunc _GUI() Global $vMainGUI = GUICreate("ADAM " & $sVersion, 285, 310) ; will create a dialog box that when displayed is centered Global $vStaffGUI = GUICreate("", 280, 265, 2, 21, $WS_CHILD, $WS_EX_CONTROLPARENT, $vMainGUI) Global $vStaffTab = GUICtrlCreateTab(0, 0, 280, 265) ; left and right are child tab border ; Create staff tab Global $vCreateStaffChildTab = GUICtrlCreateTabItem("Create Staff") GUICtrlCreateLabel("First Name :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[0][0] = GUICtrlCreateInput("", 100, 36, 135, 20) GUICtrlCreateLabel("Last Name :", 25, 63, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[1][0] = GUICtrlCreateInput("", 100, 61, 135, 20) GUICtrlCreateLabel("Staff ID :", 25, 89, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[2][0] = GUICtrlCreateInput("", 100, 86, 135, 20) GUICtrlCreateLabel("Location :", 25, 114, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[3][0] = GUICtrlCreateCombo("", 100, 111, 135, 18, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "schools") GUICtrlCreateLabel("Job Title :", 25, 139, 65, 20, $SS_RIGHT) ; left,x top, width, height $aVar[4][0] = GUICtrlCreateCombo("", 100, 137, 135, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Administrative Assistant|Assistant Principal|Bus Driver|Bus Monitor|Campus Support|Counselor|Custom|Director|Food Service|Librarian|Maintenance|Nurse|Office Manager|Principal|Psychologist|Resource Officer|SPED Teacher|SPED Teachers Aide|Teacher|Teachers Aide") ; job titles GUICtrlCreateLabel("Classification :", 20, 164, 70, 20, $SS_RIGHT) ; left, top, width, height $aVar[5][0] = GUICtrlCreateCombo("", 100, 162, 135, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Certified (T)|Classified ©") ; Create buttons Global $vCreateStaff = GUICtrlCreateButton("&Create", 25, 225, 95, 25) Global $vCreateStaffDummy = GUICtrlCreateDummy() Global $vReset1 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) ; Delete staff tab Global $vDeleteStaffChildTab = GUICtrlCreateTabItem("Delete Staff") GUICtrlCreateLabel("Username :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[6][0] = GUICtrlCreateInput("", 100, 36, 135, 20) ; Delete buttons Global $vDeleteStaff = GUICtrlCreateButton("&Delete", 25, 225, 95, 25) Global $vDeleteStaffDummy = GUICtrlCreateDummy() Global $vReset2 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) ; Move staff tab Global $vMoveStaffChildTab = GUICtrlCreateTabItem("Move Staff") GUICtrlCreateLabel("Username :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[7][0] = GUICtrlCreateInput("", 100, 36, 135, 20) GUICtrlCreateLabel("New Location :", 15, 63, 75, 20, $SS_RIGHT) ; left, top, width, height $aVar[8][0] = GUICtrlCreateCombo("", 100, 61, 135, 18, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Places") ; Move buttons Global $vMoveStaff = GUICtrlCreateButton("&Move", 25, 225, 95, 25) Global $vMoveStaffDummy = GUICtrlCreateDummy() Global $vReset3 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) GUICtrlCreateTabItem("") ; end of tabitem definition Global $vStudentGUI = GUICreate("", 280, 265, 2, 21, $WS_CHILD, $WS_EX_CONTROLPARENT, $vMainGUI) ; left and right are for child tabs Global $vStudentTab = GUICtrlCreateTab(0, 0, 280, 265) ; left and right are child tab border ; Create student tab GUICtrlCreateTabItem("Create Student") GUICtrlCreateLabel("First Name :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[9][0] = GUICtrlCreateInput("", 100, 36, 135, 20) GUICtrlCreateLabel("Last Name :", 25, 63, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[10][0] = GUICtrlCreateInput("", 100, 61, 135, 20) GUICtrlCreateLabel("Student ID :", 25, 89, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[11][0] = GUICtrlCreateInput("", 100, 86, 135, 20) GUICtrlCreateLabel("Location :", 25, 114, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[12][0] = GUICtrlCreateCombo("", 100, 111, 135, 18, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Schools") GUICtrlCreateLabel("Accounts should only be created for students in 2nd grade or above.", 45, 150, 195, 50, $SS_CENTER) ; Create buttons Global $vCreateStudent = GUICtrlCreateButton("&Create", 25, 225, 95, 25) Global $vCreateStudentDummy = GUICtrlCreateDummy() Global $vReset4 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) ; Delete student tab GUICtrlCreateTabItem("Delete Student") GUICtrlCreateLabel("Username :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[13][0] = GUICtrlCreateInput("", 100, 36, 135, 20) ; Delete buttons Global $vDeleteStudent = GUICtrlCreateButton("&Delete", 25, 225, 95, 25) Global $vDeleteStudentDummy = GUICtrlCreateDummy() Global $vReset5 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) ; Move student tab Global $vMoveStudent = GUICtrlCreateTabItem("Move Student") GUICtrlCreateLabel("Username :", 25, 38, 65, 20, $SS_RIGHT) ; left, top, width, height $aVar[14][0] = GUICtrlCreateInput("", 100, 36, 135, 20) GUICtrlCreateLabel("New Location :", 15, 63, 75, 20, $SS_RIGHT) ; left, top, width, height $aVar[15][0] = GUICtrlCreateCombo("", 100, 61, 135, 18, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "schools") ; Move buttons Global $vMoveStudent = GUICtrlCreateButton("&Move", 25, 225, 95, 25) Global $vMoveStudentDummy = GUICtrlCreateDummy() Global $vReset6 = GUICtrlCreateButton("&Reset", 155, 225, 95, 25) GUICtrlCreateTabItem("") ; end of tabitem definition GUISwitch($vMainGUI) Global $vTab = GUICtrlCreateTab(0, 0, 285, 290) ; main tab Global $vTab0 = GUICtrlCreateTabItem("Staff Account") ; primary staff tab Global $vTab1 = GUICtrlCreateTabItem("Student Account") ; primary student tab GUICtrlCreateTabItem("") ; end tabitem definition ; System menu $vFileMenu = GUICtrlCreateMenu("File") $vBulkMenu = GUICtrlCreateMenu("Bulk Functions", $vFileMenu, 1) $vBulkStaffMenu = GUICtrlCreateMenu("Staff", $vBulkMenu) Global $vBulkCreateStaff = GUICtrlCreateMenuItem("Create", $vBulkStaffMenu) Global $vBulkDeleteStaff = GUICtrlCreateMenuItem("Delete", $vBulkStaffMenu) Global $vBulkMoveStaff = GUICtrlCreateMenuItem("Move", $vBulkStaffMenu) Global $vBulkStudentMenu = GUICtrlCreateMenu("Student", $vBulkMenu) Global $vBulkCreateStudent = GUICtrlCreateMenuItem("Create", $vBulkStudentMenu) Global $vBulkDeleteStudent = GUICtrlCreateMenuItem("Delete", $vBulkStudentMenu) Global $vBulkMoveStudent = GUICtrlCreateMenuItem("Move", $vBulkStudentMenu) $vDebugItem = GUICtrlCreateMenuItem("Debug Mode", $vFileMenu) GUICtrlSetState($vDebugItem, $GUI_UNCHECKED) $vSeparator = GUICtrlCreateMenuItem("", $vFileMenu, 2) ; create separator line $vExitItem = GUICtrlCreateMenuItem("Exit", $vFileMenu) $vHelpMenu = GUICtrlCreateMenu("Help") Global $vAboutItem = GUICtrlCreateMenuItem("About", $vHelpMenu) Global $vHelpItem = GUICtrlCreateMenuItem("Help Topics", $vHelpMenu) ; Ready to create gui GUISetState() GUISetState(@SW_SHOW, $vStaffGUI) GUICtrlSetState($aVar[0][0], $GUI_FOCUS) EndFunc ;==>_GUI Edited March 13, 2012 by kor Link to comment Share on other sites More sharing options...
BrewManNH Posted March 13, 2012 Share Posted March 13, 2012 It seems that the 2 different tabs have very similar construction, just the Staff tab has more information needed in it, so you could actually put them on one tab and use a radio button that changes between Student and Staff. The boxes that don't apply to a student can either be grayed out or eliminated depending upon which radio button is selected. It would make it easier to maintain it as well because everything is put onto just 3 tabs instead of 2 tabs and 3 subtabs for each. picea892 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
sandrajolly Posted March 14, 2012 Share Posted March 14, 2012 Thanks for sharing such a helpful information. It is a very informative and useful post thanks it is good material to read this post and definitely help to increases my knowledge. Keep Sharing such a great things always!! 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