Dicemaster Slayer Posted August 14, 2006 Posted August 14, 2006 Lemme explain that... Making a game using dice (Random(1,6,1)) that is pretty complex, at least from a newbies POV, so I'm looking for a way to integrate the rules into the GUI by clicking the "?" that comes with $WS_EX_CONTEXTHELP and then on the GUI control in question. Without going too far into detail, which I all-too-often do when looking for support, how would you go about scripting to implement the "?" button as it is in normal Windows stuff? What I mean, is clicking the "?" button changes the cursor to "^?" and then you click a control, and Windows tells you what it is. Now for the totally newb/lazyman's question: what does AutoIt do when it sets a GUI with $WS_EX_CONTEXTHELP?
GaryFrost Posted August 14, 2006 Posted August 14, 2006 Lemme explain that...Making a game using dice (Random(1,6,1)) that is pretty complex, at least from a newbies POV, so I'm looking for a way to integrate the rules into the GUI by clicking the "?" that comes with $WS_EX_CONTEXTHELP and then on the GUI control in question.Without going too far into detail, which I all-too-often do when looking for support, how would you go about scripting to implement the "?" button as it is in normal Windows stuff? What I mean, is clicking the "?" button changes the cursor to "^?" and then you click a control, and Windows tells you what it is.Now for the totally newb/lazyman's question: what does AutoIt do when it sets a GUI with $WS_EX_CONTEXTHELP? AutoIt doesn't do anything with it, you'll have to setup the HELPINFO for the control(s)A place to start with the $WS_EX_CONTEXTHELPhttp://www.autoitscript.com/forum/index.ph...c=29735&hl=you'll have to work from there. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Zib Posted August 14, 2006 Posted August 14, 2006 I have been fooling around with this and ran into 1 problem I couldn't fix. When I run this the mouse cursor doesn't change to the "?" one. However, when I comment out the GUIRegisterMsg, it does. expandcollapse popup#include <GUIConstants.au3> Global Const $WM_SYSCOMMAND = 0x112; Global Const $SC_CONTEXTHELP = 0xF180; GUICreate("My GUI", 200, 200, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $DS_CONTEXTHELP), $WS_EX_CONTEXTHELP) $Edit = GUICtrlCreateEdit("", 1, 1, 150, 70) $Checkbox = GUICtrlCreateCheckbox("Checkbox", 1, 100) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND_Events") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;; EndSelect WEnd Func WM_SYSCOMMAND_Events($hWndGUI, $MsgID, $wParam, $lParam) Switch $wParam Case $SC_CONTEXTHELP _DebugPrint($wParam) $ContextHelp = True Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _DebugPrint($s_text) $s_text = StringReplace(StringReplace($s_text, @CRLF, @LF), @LF, @LF & "!-->") ConsoleWrite( _ "+===========================================================" & @LF & _ "!-->" & $s_text & @LF & _ "+===========================================================" & @LF & @LF) EndFunc ;==>_DebugPrint
GaryFrost Posted August 14, 2006 Posted August 14, 2006 Func WM_SYSCOMMAND_Events($hWndGUI, $MsgID, $wParam, $lParam) Switch $wParam Case $SC_CONTEXTHELP _DebugPrint($wParam) $ContextHelp = True EndSwitch Return $GUI_RUNDEFMSG EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Zib Posted August 14, 2006 Posted August 14, 2006 Wow, thanks gafrost; I spent way too much time trying to find out whats wrong for it to be something so lame.. lol. I am going to try and get the whole thing togethor now.
Zib Posted August 14, 2006 Posted August 14, 2006 (edited) I managed to get a working example. It works for the most part. It still needs some more Tooltip clearing logic and for some reason whenever you type something in the Edit control the mouse dissapears until you move it. I don't know why that happened. However, I think I will stick with GUICtrlSetTip() rather than this. expandcollapse popup#include <GUIConstants.au3> Global Const $WM_SYSCOMMAND = 0x112; Global Const $SC_CONTEXTHELP = 0xF180; GUICreate("My GUI", 200, 200, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $DS_CONTEXTHELP), $WS_EX_CONTEXTHELP) $Edit = GUICtrlCreateEdit("", 1, 1, 150, 70) $Checkbox = GUICtrlCreateCheckbox("Checkbox", 1, 100) $ContextHelp = False GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND_Events") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $ContextHelp = True While 1 $ContextHelp = False $MouseData = GUIGetCursorInfo() If $MouseData[2] = 1 Then Switch $MouseData[4] Case $Checkbox Tooltip("This is a checkbox") Case $Edit Tooltip("This is an edit box") Case Else Tooltip("") EndSwitch ExitLoop EndIf WEnd Case $msg > 0 ToolTip("") Case Else ;; EndSelect WEnd Func WM_SYSCOMMAND_Events($hWndGUI, $MsgID, $wParam, $lParam) Switch $wParam Case $SC_CONTEXTHELP $ContextHelp = True EndSwitch Return $GUI_RUNDEFMSG EndFunc Edited August 14, 2006 by Zib
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