Jump to content

$WS_EX_CONTEXTHELP Help


Recommended Posts

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?

:whistle:

Link to comment
Share on other sites

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?

:whistle:

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_CONTEXTHELP

http://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.

 

Link to comment
Share on other sites

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.

#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
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

#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 by Zib
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...