Elephant007 Posted November 4, 2015 Share Posted November 4, 2015 (edited) So here I am again asking for little help to finish off something that I've started to hopefully manage our school districts networked printer list easier by using a GUI instead of having to go though and edit an XML fileThe problem I'm having is that the ComboBoxes I'm creating has so much data that it will not display all the data without setting _GUICtrlComboBox_SetEditText($ACAMPUSNUMBER,""). Once I set that, I'm unable to set the ComboBox to be read-only. I would like for this to be set to read-only so that the person using the GUI will not enter their own made up data.. Here's what I have so farexpandcollapse popup$FILE_NAME = "Printer.ini" GUICreate("Network Print Editor") GUISetState() GUISetFont(12) GUICtrlCreateGroup("Delete Printer From List", 10, 10, 380, 100) GUICtrlCreateLabel("Printer Name", 20, 40, 120, 15) $DPRINTER_NAME = GUICtrlCreateInput("", 150, 40, 220, 25,$ES_UPPERCASE+$ES_AUTOHSCROLL) GUICtrlCreateGroup("Add Printer To List", 10, 150, 380, 130) GUICtrlCreateLabel("Campus", 20, 180, 120, 20) $ACAMPUSNUMBER = GUICtrlCreateCombo("", 150, 176, 220, 25) GUICtrlSetData(-1,StringUpper("[Elementary]|080 - McMurry|102 - Austin|103 - Bonham|104 - Bowie|108 - Dyess|112 - Jackson|113 - Johnston|116 - Lee|118 - Long|120 - Reagan|121 - Taylor|150 - Ward|151 - Thomas|152 - Oritz|153 - Bassetti|155 - Martinez|[High]|001 - Abilene High|002 - Cooper High|003 - Woodson High|009 - Holland High|010 - ATEMS High|[Instructional Support]|008 - Transportation|101 - Adult Education|131 - Planetarium|200 - Technology Center|201 - One AISD Center|202 - Technology Support|238 - Warehouse|251 - Maintenance|[Middle]|044 - Madison|045 - Mann|047 - Clack|48 - Craig|[Others]|042 - Jefferson Center|088 - Taylor County Juvenile Justice|107 - Crockett Early Head Start|117 - Locust Early Childhood|125 - Woodson Early Childhood|138 - Woodson Early Head Start|")) _GUICtrlComboBox_SetEditText($ACAMPUSNUMBER, "") GUICtrlCreateLabel("Printer Name", 20, 210, 120, 20) $APRINTERNAME = GUICtrlCreateInput("", 150, 210, 220, 25,$ES_UPPERCASE+$ES_AUTOHSCROLL) GUICtrlCreateLabel("Print Server", 20, 245, 120, 20) $APRINTSERVER = GUICtrlCreateCombo("", 150, 245, 220, 25,$CBS_DROPDOWNLIST) GUICtrlSetData(-1,"PRINTADMIN|PRINTELEM|PRINTHIGH|PRINTMIDDLE|PRINTXEROX") $CHANGE = GUICtrlCreateButton("Commit Changes", 20, 290, 360, 100) While 1 $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE ExitLoop Case $CHANGE If GUICtrlRead($DPRINTER_NAME) = "" Then Sleep(1) Else $Q = MsgBox(68, "Edit File", "Delete Printer: " & GUICtrlRead($DPRINTER_NAME)) If $Q = 6 Then $LINE_TEXT_INPUT = GUICtrlRead($DPRINTER_NAME) $FILE_COUNT_LINES = _FileCountLines($FILE_NAME) For $I = 0 To $FILE_COUNT_LINES $LINES_TEXT_OUTPUT = FileReadLine($FILE_NAME, $I) If StringInStr($LINES_TEXT_OUTPUT, $LINE_TEXT_INPUT) Then _FileWriteToLine($FILE_NAME, $I, "", 1) EndIf Next FileWriteLine('\\printadmin\drivers\Network_Print_Editor\logs\Network_Print_Editor.log',@MON&'/'&@MDAY&'/'&@YEAR&' @ '&@HOUR&':'&@MIN&':'&@SEC&' Printer Delete - '&GUICtrlRead($DPRINTER_NAME)&' by: '&@UserName) EndIf EndIf If GUICtrlRead($ACAMPUSNUMBER) = "" Or GUICtrlRead($APRINTERNAME) = "" Or GUICtrlRead($APRINTSERVER) = "" Then Sleep(1) Else $Q = MsgBox(68, "Edit File", "Add Printer: " & GUICtrlRead($APRINTERNAME) & @CRLF & "Print Server: " & GUICtrlRead($APRINTSERVER) & @CRLF & "Campus: " & StringUpper(GUICtrlRead($ACAMPUSNUMBER))) If $Q = 6 Then IniWrite($FILE_NAME, StringMid(GUICtrlRead($ACAMPUSNUMBER),1,3), GUICtrlRead($APRINTERNAME),'\\'&GUICtrlRead($APRINTSERVER)&'\'&GUICtrlRead($APRINTERNAME)) FileWriteLine('\\printadmin\drivers\Network_Print_Editor\logs\Network_Print_Editor.log',@MON&'/'&@MDAY&'/'&@YEAR&' @ '&@HOUR&':'&@MIN&':'&@SEC&' Printer Add - Campus: ('&StringMid(GUICtrlRead($ACAMPUSNUMBER),1,3)&') Name: ('& GUICtrlRead($APRINTERNAME)&') Path: (\\'&GUICtrlRead($APRINTSERVER)&'\'&GUICtrlRead($APRINTERNAME)&') by: '&@UserName) EndIf EndIf GUICtrlSetData($DPRINTER_NAME, "") GUICtrlSetData($APRINTERNAME, "") _GUICtrlComboBox_SetCurSel($ACAMPUSNUMBER, -1) _GUICtrlComboBox_SetCurSel($APRINTSERVER, -1) EndSwitch WEndThank you in advance for your help! Edited November 4, 2015 by Elephant007 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2015 Moderators Share Posted November 4, 2015 Elephant007,When you set a style for a control you overwrite all the current styles. So in your case, setting the $CBS_DROPDOWNLIST style removes all the scrolling styles and you do not see all the entries. Combining the styles lets the combos display as you require:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ComboConstants.au3> $FILE_NAME = "Printer.ini" GUICreate("Network Print Editor") GUISetFont(12) GUICtrlCreateGroup("Delete Printer From List", 10, 10, 380, 100) GUICtrlCreateLabel("Printer Name", 20, 40, 120, 15) $DPRINTER_NAME = GUICtrlCreateInput("", 150, 40, 220, 25, BitOR($ES_UPPERCASE, $ES_AUTOHSCROLL)) GUICtrlCreateGroup("Add Printer To List", 10, 150, 380, 130) GUICtrlCreateLabel("Campus", 20, 180, 120, 20) $ACAMPUSNUMBER = GUICtrlCreateCombo("", 150, 176, 220, 25, BitOR($ES_UPPERCASE, $GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, StringUpper("[Elementary]|080 - McMurry|102 - Austin|103 - Bonham|104 - Bowie|108 - Dyess|112 - Jackson|113 - Johnston|116 - Lee|118 - Long|120 - Reagan|121 - Taylor|150 - Ward|151 - Thomas|152 - Oritz|153 - Bassetti|155 - Martinez|[High]|001 - Abilene High|002 - Cooper High|003 - Woodson High|009 - Holland High|010 - ATEMS High|[Instructional Support]|008 - Transportation|101 - Adult Education|131 - Planetarium|200 - Technology Center|201 - One AISD Center|202 - Technology Support|238 - Warehouse|251 - Maintenance|[Middle]|044 - Madison|045 - Mann|047 - Clack|48 - Craig|[Others]|042 - Jefferson Center|088 - Taylor County Juvenile Justice|107 - Crockett Early Head Start|117 - Locust Early Childhood|125 - Woodson Early Childhood|138 - Woodson Early Head Start|")) ;_GUICtrlComboBox_SetEditText($ACAMPUSNUMBER, "") GUICtrlCreateLabel("Printer Name", 20, 210, 120, 20) $APRINTERNAME = GUICtrlCreateInput("", 150, 210, 220, 25, BitOR($ES_UPPERCASE, $ES_AUTOHSCROLL)) GUICtrlCreateLabel("Print Server", 20, 245, 120, 20) $APRINTSERVER = GUICtrlCreateCombo("", 150, 245, 220, 25, BitOR($ES_UPPERCASE, $GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "PRINTADMIN|PRINTELEM|PRINTHIGH|PRINTMIDDLE|PRINTXEROX") $CHANGE = GUICtrlCreateButton("Commit Changes", 20, 290, 360, 100) GUISetState() While 1 $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE ExitLoop Case $CHANGE If GUICtrlRead($DPRINTER_NAME) = "" Then Sleep(1) Else $Q = MsgBox(68, "Edit File", "Delete Printer: " & GUICtrlRead($DPRINTER_NAME)) If $Q = 6 Then $LINE_TEXT_INPUT = GUICtrlRead($DPRINTER_NAME) $FILE_COUNT_LINES = _FileCountLines($FILE_NAME) For $I = 0 To $FILE_COUNT_LINES $LINES_TEXT_OUTPUT = FileReadLine($FILE_NAME, $I) If StringInStr($LINES_TEXT_OUTPUT, $LINE_TEXT_INPUT) Then _FileWriteToLine($FILE_NAME, $I, "", 1) EndIf Next FileWriteLine('\\printadmin\drivers\Network_Print_Editor\logs\Network_Print_Editor.log', @MON & '/' & @MDAY & '/' & @YEAR & ' @ ' & @HOUR & ':' & @MIN & ':' & @SEC & ' Printer Delete - ' & GUICtrlRead($DPRINTER_NAME) & ' by: ' & @UserName) EndIf EndIf If GUICtrlRead($ACAMPUSNUMBER) = "" Or GUICtrlRead($APRINTERNAME) = "" Or GUICtrlRead($APRINTSERVER) = "" Then Sleep(1) Else $Q = MsgBox(68, "Edit File", "Add Printer: " & GUICtrlRead($APRINTERNAME) & @CRLF & "Print Server: " & GUICtrlRead($APRINTSERVER) & @CRLF & "Campus: " & StringUpper(GUICtrlRead($ACAMPUSNUMBER))) If $Q = 6 Then IniWrite($FILE_NAME, StringMid(GUICtrlRead($ACAMPUSNUMBER), 1, 3), GUICtrlRead($APRINTERNAME), '\\' & GUICtrlRead($APRINTSERVER) & '\' & GUICtrlRead($APRINTERNAME)) FileWriteLine('\\printadmin\drivers\Network_Print_Editor\logs\Network_Print_Editor.log', @MON & '/' & @MDAY & '/' & @YEAR & ' @ ' & @HOUR & ':' & @MIN & ':' & @SEC & ' Printer Add - Campus: (' & StringMid(GUICtrlRead($ACAMPUSNUMBER), 1, 3) & ') Name: (' & GUICtrlRead($APRINTERNAME) & ') Path: (\\' & GUICtrlRead($APRINTSERVER) & '\' & GUICtrlRead($APRINTERNAME) & ') by: ' & @UserName) EndIf EndIf GUICtrlSetData($DPRINTER_NAME, "") GUICtrlSetData($APRINTERNAME, "") _GUICtrlComboBox_SetCurSel($ACAMPUSNUMBER, -1) _GUICtrlComboBox_SetCurSel($APRINTSERVER, -1) EndSwitch WEndNote the correct usage of BitOR to combine styles - see the Setting Styles tutorial in the Wiki to understand why this is so.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...
Elephant007 Posted November 4, 2015 Author Share Posted November 4, 2015 Once again, you've given great help! I was unaware you could do a mixture of $ES_, $GUI_SS_ and $CBS_This worked wonderfully. When I was searching for a solution on not all my data showing in the comboboxes I found a post where you suggested using _GUICtrlComboBox_SetEditText...And if you're wondering, we are still using the computer name wizard GUI you basically built for our use... I've learned from you and modified it here and there, basically keeping it the way you rewrote it though... we thank you for your help Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2015 Moderators Share Posted November 5, 2015 Elephant007,Glad I could help (again).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