packrat Posted January 22, 2009 Share Posted January 22, 2009 The dialog box below has a button which the user can click to close the dialog box or where the user can press the ENTER key as a substitute for the mouseclick. Pressing ENTER works fine, but I can't seem to get the button to react to a mouseclick. I've got to be overlooking something obvious, but I just can't seem to see it. Can anyone help? CODE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <Date.au3> #include <File.au3> ;------------------------------------------------------------ Func ShowStopDialog( $txt1, $txt2 ) Local $WinHandle2 Local $OkButton Local $msg ; $WinHandle2 = GUICreate( "" , 665, 115, 75, 200, BitOR($WS_POPUP, $WS_BORDER) ) GUISetBkColor(0xFFFFCC) ; GUICtrlCreateLabel( $txt1, 5, 10, 650, 45, $SS_CENTER ) GUICtrlSetFont(-1, 30, 800, 0, "Arial" ) GUICtrlSetColor(-1,0xFF1C3C) GUICtrlCreateLabel( $txt2, 15, 70, 650, 36, $SS_CENTER ) GUICtrlSetFont(-1, 18, 800, 0, "Arial" ) GUICtrlSetColor(-1,0x0000FF) ; $OkButton = GUICtrlCreateButton ("OK", 580, 85, 75, 22, $BS_FLAT ) GUICtrlSetState( $OkButton, $GUI_ENABLE ) GUICtrlSetFont( -1, 8, 1200, 0, "Arial") GUICtrlSetBkColor( -1, 0xFFFFAA ) ; GUICtrlSetState( $OkButton, $GUI_FOCUS ) GUICtrlSetState( $OkButton, $GUI_DEFBUTTON ) GUISetState(@SW_SHOW,$WinHandle2) ; WinSetOnTop("[ACTIVE]", "", 1) ; $msg = 0 While True $msg = GUIGetMsg() Select Case $msg = $OkButton ExitLoop EndSelect Wend GUIDelete($WinHandle2) EndFunc ;------------------------------------------------------------ $txt = "BARCODE PROBLEM" ShowStopDialog( $txt, "P U T A S I D E" ) Thanks in advance! Harvey Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2009 Moderators Share Posted January 22, 2009 (edited) packrat,Your labels are too big and the button is overlapping them. AutoIt does not accept 2 active controls in the same space - I assume it looks for mouse click coordinates and then cannot decide which control has been activated.I suggest either disabling the labels (but that makes the text go grey) or making them smaller so the button is in "clear" space. Hint - use GUICtrlSetBkColor to colour the labels and so clearly see their extent.M23 Edited January 23, 2009 by Melba23 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...
packrat Posted January 22, 2009 Author Share Posted January 22, 2009 packrat,Your labels are too big and the button is overlapping them. AutoIt does not accept 2 active controls in the same space - I assume it looks for mouse click coordinates and then cannot decide which control has been activated.I suggest aither disabling the labels (but that makes the text go grey) or making them smaller so the button is in "clear" space. Hint - use GUICtrlSetBkColor to colour the labels and so clearly see their extent.M23Boy, you'd think I'd learn from my mistakes! This happened once before, and someone here noted the same solution: shorten the label so it doesn't overlap. Thanks for your helpful response, and maybe this time it'll stick in my mind! Harvey 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