
mdp716
Members-
Posts
7 -
Joined
-
Last visited
Everything posted by mdp716
-
OK, so I am understanding that it is not as easy as I hoped it would be due to it being default windows behavior. As for setting the colors on labels, I do not have a problem with that - this appears to be specific to the Combo control as near as I can tell as I have never had an issue with providing colors for labels or most other controls that I have used up to this point. Thanks for your help. Guess I will just live with having to choose either being able to pick the color or pick it being non-editable.
-
I use disable because there is a process that downloads information that is used to populate the ComboBox that has to happen before the ComboBox can be used. Once that process completes the control is enabled. Even so, when the control is enabled, it still shows a different face color when $CBS_DROPDOWNLIST is used than when that flag/constant is NOT used. Thus, this answer does not address the issue. But thanks for the effort ;-)
-
Greetings all, I am having difficulty with a combo box's appearance in the GUI. When I create the combo box with this: $editApplication = GUICtrlCreateCombo("Select Application", 22, 412, 405, 22) it appears with a White background in the GUI. However, I desire this to be a non editable object so I use this to create it instead: $editApplication = GUICtrlCreateCombo("Select Application", 22, 412, 405, 22, $CBS_DROPDOWNLIST) ...and when I do that, the appearance of the object is with a Grey background which is undesirable. I have not been able to figure out how to make it both a non editable control and have a white background. Can someone show me what I need to do this? Your assistance is greatly appreciated. Here is the code, I have stripped out a lot of the code not necessary to demonstrate my problem. As well, you will see that I commented out the lines of code that use the $CBS_DROPDOWNLIST constant so I can easily switch back and forth to the lines with and without that constant. #include <File.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <GuiComboBoxEx.au3> Global $version = "1.0" Global $deviceName = "Enter APS Printer Device Name Here" Global $gUI, $btnAPSTest, $editDeviceName, $iMsg, $nMsg Global $editApplication, $Application, $editPrintJob, $PrintJob Global $aData CreateGUI() ;The following are place holders for code removed from this example ;to similate the downloading of the data from a web site GUICtrlSetData($editApplication, "Application 1") GUICtrlSetData($editApplication, "Application 2") GUICtrlSetData($editApplication, "Application 3") Sleep(500) GUICtrlSetState($editApplication, $GUI_ENABLE) GUICtrlSetData($editPrintJob, "Print Job 1") GUICtrlSetData($editPrintJob, "Print Job 2") GUICtrlSetData($editPrintJob, "Print Job 3") GUICtrlSetData($editPrintJob, "Print Job 4") Sleep(500) GUICtrlSetState($editPrintJob, $GUI_ENABLE) Sleep(500) GUICtrlSetState($editDeviceName, $GUI_ENABLE) ;end place holders Global $accEnter = GUICtrlCreateDummy() Global $a_AccelKeys[1][2] = [["{ENTER}", $accEnter]] GUISetAccelerators($a_AccelKeys) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $editApplication If _GUICtrlEdit_GetText($editApplication) = "Select Application" Then MsgBox(,0, "Error", "Invalid Selection") Else Sleep(2000) GUICtrlSetState($editPrintJob, $GUI_ENABLE) EndIf Case $accEnter Switch GuiCtrlGetFocus($gUI) Case $editDeviceName MsgBox(0, "TEST", GuiCtrlGetFocus($gUI)) GUICtrlSetState($editApplication, $GUI_ENABLE) GUICtrlSetState($editApplication, $GUI_FOCUS) Case $editApplication If _GUICtrlEdit_GetText($editApplication) = "Select Application" Then MsgBox(0, "Test 1", "Am Here") Else GUICtrlSetState($editClose, $GUI_FOCUS) _GUICtrlEdit_SetSel($editClose, 0, -1) EndIf Case $editPrintJob If NOT ValidateTimes() Then MsgBox(0, "Test 2", "Am Here") _GUICtrlEdit_SetSel($editClose, 0, -1) Else GUICtrlSetState($btnConfig, $GUI_FOCUS) EndIf Case Else GUISetAccelerators("") ControlSend($gUI, "", GuiCtrlGetFocus($gUI), "{ENTER}") GUISetAccelerators($a_AccelKeys) EndSwitch Case $btnAPSTest MsgBox(0, "Pressed", "Button Pressed") EndSwitch WEnd CleanUp() Exit #cs ================================================================= ===================================================================== Function: CreateGUI() Arguments: N/A Requires: Purpose: Creates the User Interface ===================================================================== ===================================================================== #ce Func CreateGUI() $gUI = GUICreate("APS Print Test", 450, 550, -1, -1) GUISetIcon("C:\UAL\LPR\APSPT.ico", -1) GUISetBkColor(0xC0C0C0) GUICtrlCreatePic(@TempDir & "\" & "UA_BG_450X328.jpg", 0, 0, 450, 328) GUICtrlCreateGroup("", 8, 330, 435, 215) GUICtrlCreateGroup("Enter Printer DeviceName:", 15, 340, 420, 50) GUICtrlCreateGroup("Select Application:", 15, 395, 420, 50) GUICtrlCreateGroup("Select Print Job:", 15, 450, 420, 50) ;Banner Text GUISetFont(16, 400, 0, "Verdana") GUICtrlCreateLabel("APS Printer Test", 0, 10, 440, 30, $SS_CENTER) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; White Text GUISetFont(10, 400, 0, "Verdana") GUICtrlCreateLabel("Version " & $version, 5, 310, 90, 14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; White Text GUISetFont(10, 400, 0, "Verdana") GUICtrlCreateLabel("Company Name Here", 250, 310, 250, 14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; White Text GUISetFont (10, 400, 0, "Verdana") ;LABELS GUISetFont(14, 400, 0, "Verdana") Global $iMsg = GUICtrlCreateLabel("", 0, 50, 450, 23, $SS_CENTER) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; White Text ;INPUTS $editDeviceName = GUICtrlCreateEdit($deviceName, 22, 355, 405, 30, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER)) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetState($editDeviceName, $GUI_DISABLE) $editApplication = GUICtrlCreateCombo("Select Application", 22, 412, 405, 22) ; $editApplication = GUICtrlCreateCombo("Select Application", 22, 412, 405, 22, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetState($editApplication, $GUI_DISABLE) $editPrintJob = GUICtrlCreateCombo("Select Print Job", 22, 467, 405, 22) ; $editPrintJob = GUICtrlCreateCombo("Select Print Job", 22, 467, 405, 22, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetState($editPrintJob, $GUI_DISABLE) ;Buttons $BtnAPSTest = GUICtrlCreateButton("Send Test Print", 15, 508, 420, 30) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) EndFunc
-
That worked flawlessly - thank you so much for you help.
-
Well that sure looks right - no doubt the problem is the solution was far simpler than I was thinking. Will test it out tomorrow and let you know, thanks for this so much.
-
Hello - I think StringRegExp() is going to give me a headace. What I am looking to do is test a string which should match the following: 1. Will always be 8 characters long 2. Will always start with "P" 3. 2nd, 3rd, and 4th Characters will always be Alpha (from 'A' to 'Z') 4. 5th, 6th, 7th, and 8th Characters will always be hexidecimal (from '0' through '9' or 'A' to 'F') The test string will already be all caps due to the Edit box style settings so no need to worry about lower case. So basically, I am looking for an expression that will identify if the above rules are met in the tested string. I know this should not be that hard, but I've spent a few hours on this already and haven't found the expression that will not allow errors to slip by. Any one of you wizards out there have a quick answer to this? Thanks in advance.
-
Send a raw file to a printer?
mdp716 replied to emendelson's topic in AutoIt General Help and Support
Martin, I know that this post's thread was from several years ago but I am hopeful of some help. I have a need to print raw data to a specialized printer which is set up in Windows 7 as a Generic Text Printer either as a RS-232 device or an IP networked printer. Your script above, along with your DLL and UDP work flawlessly when the printer is set up as a RS-232 connected device, but while the printer is getting data as apparent by the activity light on the printer, it does not print when set up as an IP based device. Not sure what the difference would be and why it works one way but not the other. Any thoughts? Thanks in advance.