Jump to content
akfourtyseven

F1 key help

Recommended Posts

akfourtyseven

I have made a GUI program and made it display the help file when the help button is pressed or when F1 is pressed. The problem is, when you press F1 it opens the help file multiple times depending on how long you pressed it. Is there any way to fix this, and here is the code (I left out irrelevant parts)

$GUIWidth = 450
$GUIHeight = 320
$helpmenu = GuiCtrlCreateMenu ("Help")
$helptopics = GUICtrlCreateMenuitem ("Help Topics   F1",$helpmenu)
$dll = DllOpen("user32.dll")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Helptopics or _IsPressed("70", $dll)
        ShellExecute("help\help.chm","","","",@SW_MAXIMIZE)
EndSelect
WEnd
DllClose($dll)

There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites
akfourtyseven

In this case it would be better ot use HotKeySet() or GUISetAccelerators(), see helpfile

Thanx man! But I have no Idea :)

Can you show me how to insert the function?


There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites
AdmiralAlkex

Thanx man! But I have no Idea :)

Can you show me how to insert the function?

Try the examples in the helpfile, they are really easy if you look at them

Share this post


Link to post
Share on other sites
akfourtyseven

Try the examples in the helpfile, they are really easy if you look at them

Thanx man! I have figured it out!


There are 10 kinds of people, those who understand me and those who don't.

Share this post


Link to post
Share on other sites
ChangMinYang

I have made a GUI program and made it display the help file when the help button is pressed or when F1 is pressed. The problem is, when you press F1 it opens the help file multiple times depending on how long you pressed it. Is there any way to fix this, and here is the code (I left out irrelevant parts)

$GUIWidth = 450
$GUIHeight = 320
$helpmenu = GuiCtrlCreateMenu ("Help")
$helptopics = GUICtrlCreateMenuitem ("Help Topics   F1",$helpmenu)
$dll = DllOpen("user32.dll")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Helptopics or _IsPressed("70", $dll)
        ShellExecute("help\help.chm","","","",@SW_MAXIMIZE)
EndSelect
WEnd
DllClose($dll)

If ProcessExists( "hh.exe" ) < 1 Then
    ShellExecute ...
EndIf

Share this post


Link to post
Share on other sites
Melba23

akfourtyseven,

Use the builtin Autoit function GUISetHelp - this is what it was designed for!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Euler G.
On 21/02/2009 at 10:41 AM, Melba23 said:

akfourtyseven,

 

Use the builtin Autoit function GUISetHelp - this is what it was designed for!

 

M23

Melba23,
I'm trying to address a context sensitive help. I already found a piece of code on forum that I adapted to my needs but still struggling with call the right CHM index if focus is on an input field or other control.

Here is the function I'm using (it's a quick'n'dirty prototype):
 

; ----------------------------------------
; Calls HTML help file (.CHM), given:
; help file name (only) - defaults to @ScriptName with chm extension
; Help file path (only) - defaults to @ScriptDir
; Opens help file at the givem section if both exist.
; Example: _NavigateCHM("/html/hs41.htm")
; ----------------------------------------
Func _NavCHM($sSection, $sFilePath = @ScriptDir, $sFileName = StringTrimRight(@ScriptName, 3) & "chm")
    
    Local $hWnd = WinWait('[TITLE:' & $sTitle & ' - complementary HTML Help title; CLASS:HH Parent]', "", 5)
    If StringLeft($sSection, 6) <> "/html/" Then $sSection = "/html/" & $sSection
    If StringRight($sSection, 4) <> ".htm" Then $sSection &= ".htm"
    If IsHWnd($hWnd) Then
        ; Help already open
        WinActivate($hWnd)
        Local $oIE = _IEAttach($sTitle & ' - complementary HTML Help title', 'Embedded')
        _IENavigate($oIE, 'mk:@MSITStore:' & $sFilePath & '\' & $sFileName & '::' & $sSection)
    Else
        Run('"' & @WindowsDir & '\' & 'hh.exe" "' & $sFilePath & '\' & $sFileName & '::' & $sSection & '"')
    EndIf
EndFunc   ;==>_NavCHM

As said already, I found this code here but forgot the author(s). I just want to acknowledge their job and I'm grateful they shared their solution.

Back to GUISetHelp(), could it be used with any GUI handle or just that from GUICreate()? Or maybe I should look into HotKeySet() to call _NavCHM with the proper CHM section reference. TIA for any hints.

 

Share this post


Link to post
Share on other sites
JLogan3o13

@Euler G. did you happen to notice this thread is over 9 years old?? Please don't resurrect old threads.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
JLogan3o13

Typically, it is better to start your own thread rather than commandeer someone else's yes. And we try to avoid resurrecting very old threads as the language continues to grow and evolve. What may have worked 2 or 3 (or 9) years ago may not work the same today.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Euler G.

@JLogan3o13 Thanks for your clarification and heads-up. I could start a new post and make a reference to this one (pointed to me by the search engine) but I thought it could be seen as a violation to forum rules. I'll try to be more careful. As Melba23, I'm also old. :)

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.