Sign in to follow this  
Followers 0
piratao2

How to assign different help topics to fields of my GUI

7 posts in this topic

I managed to build my CHM help file with Help Maker.

Now I wanted to be able to assign diferent help topics depending on the current control in focus on my GUI when the user presses F1. Is it possible?

Thanks in advance.

Share this post


Link to post
Share on other sites



I managed to build my CHM help file with Help Maker.

Now I wanted to be able to assign diferent help topics depending on the current control in focus on my GUI when the user presses F1. Is it possible?

Thanks in advance.

As far as knowing what control has focus you can use ControlGetFocus, then pass that as a parameter, although I don't know anything about Help Maker.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

You need to set the hotkey.

In the function you should,

Check if the window (your GUI) is active). If yes, proceed.

Get the current focused control.

Run the helpfile with Command Line paramaters. More info can be found here.

Cheers,

Brett

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks guys... hurry now, but will take a look on the link that BrettF has provided.

The main difficulty to me is how to "Run the helpfile with Command Line paramaters".

Thanks!

Edited by piratao2

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This and much =more is available in Autoit Wrappers

; Open help file / Open a desired page
; Author - gafrost

$sAutoItPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

Run(@WindowsDir & "\HH.exe " & $sAutoItPath & "\AutoIt3.chm::/html/functions/GUICtrlCreateUpdown.htm")

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

$Form = GUICreate("My GUI", 400, 400, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $DS_CONTEXTHELP), $WS_EX_CONTEXTHELP)

$Button = GUICtrlCreateButton("Exit", 165, 360, 70, 23)
GUIRegisterMsg($WM_HELP, '_WM_HELP')

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $Button, $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_HELP($hWnd, $msgID, $wParam, $lParam)

;   Local $tHELPINFO = DllStructCreate('uint cbSize;int iContextType;int iCtrlId;hwnd hItemHandle;int dwContextId;int X;int Y', $lParam)
;   Local $tPOINT = DllStructCreate('int X;int Y')
;   DllStructSetData($tPOINT, 'X', DllStructGetData($tHELPINFO, 'X'))
;   DllStructSetData($tPOINT, 'Y', DllStructGetData($tHELPINFO, 'Y'))

    Local $tPOINT = _WinAPI_GetMousePos()
    Local $hHandle = _WinAPI_WindowFromPoint($tPOINT)
    Local $ID = _WinAPI_GetDlgCtrlID($hHandle)

    Switch $ID
        Case $Button
            Run('hh.exe ' & RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\AutoIt3.chm')
    EndSwitch
EndFunc   ;==>_WM_HELP

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I ended up with Yashied's suggestion but have changed it a little bit to catch the current control in focus, not the current control under the mouse pointer. The way it was originally, it was taking the ID for the control under the current mouse pointer position. The way I've changed it, it takes the current control in focus. which is more interesting.

Func _WM_HELP($hWnd, $msgID, $wParam, $lParam)
;   Local $tPOINT = _WinAPI_GetMousePos()
    Local $hHandle = _WinAPI_GetFocus()
;   Local $hHandle = _WinAPI_WindowFromPoint($tPOINT)
    Local $ID = _WinAPI_GetDlgCtrlID($hHandle)

    Switch $ID
        Case $INP_AddGroup
            Run('hh.exe ' & $helpfile & "::/mainscreen.html#main1")
        Case $BTN_AddGroup
            Run('hh.exe ' & $helpfile & "::/mainscreen.html#main2")
;...
    case Else
        Run('hh.exe ' & $helpfile)
    EndSwitch
EndFunc

Hope someone else can benefit from this...

Edited by piratao2

Share this post


Link to post
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
Sign in to follow this  
Followers 0