How to use HELPBUTTON?
Posted: Sun May 22, 2016 9:00 am
I have not been able to figure out how to use the HELPBUTTON clause of the DEFINE WINDOW command. There is no sample for this in HMG, but an old discussion on this forum (http://hmgforum.com/viewtopic.php?f=5&t=1312) points to a demo in MiniGui (SAMPLES\BASIC\HELP) which uses both HELPBUTTON and SET HELPFILE with an .HLP file. But .HLP files are obsolete and are not supported in Windows 7 or later without a special download.
I tried modifying this demo to use a .CHM file, but I have not been able to get this to work. This modified version is below. It displays a help button ("?") in the upper right corner next to the close button ("x"), but clicking on the help button does nothing except change the mouse cursor.
I believe that both HMG and MiniGui supported .CHM files under XP. I am now using Windows 7. So it seems that pressing F1 should display HelpDemo.chm, but instead it displays a box titled "Windows Help and Support" that says "Why can't I get Help from this program?" and then explains that I have to download an .HLP reader. So for some reason F1 seems to be looking for an .HLP file, even though I have done SET HELPFILE to a .CHM file.
As a workaround to SET HELPFILE, I can use ON KEY F1 ACTION <.CHM launcher>. I have tried this and it works. But I do not see any way to use HELPBUTTON. Does anyone know this?
TIA for your help!
I tried modifying this demo to use a .CHM file, but I have not been able to get this to work. This modified version is below. It displays a help button ("?") in the upper right corner next to the close button ("x"), but clicking on the help button does nothing except change the mouse cursor.
I believe that both HMG and MiniGui supported .CHM files under XP. I am now using Windows 7. So it seems that pressing F1 should display HelpDemo.chm, but instead it displays a box titled "Windows Help and Support" that says "Why can't I get Help from this program?" and then explains that I have to download an .HLP reader. So for some reason F1 seems to be looking for an .HLP file, even though I have done SET HELPFILE to a .CHM file.
As a workaround to SET HELPFILE, I can use ON KEY F1 ACTION <.CHM launcher>. I have tried this and it works. But I do not see any way to use HELPBUTTON. Does anyone know this?
TIA for your help!
Code: Select all
// Modified version of help demo in MiniGui SAMPLES\BASIC\HELP\Demo.prg
#include "hmg.ch"
#define IDH_0001 10001
#define IDH_0002 10002
#define IDH_0003 10003
Function Main()
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 600 HEIGHT 400 ;
TITLE 'Help Demo' ;
ICON 'demo.ico' ;
MAIN ;
FONT 'MS Sans Serif' SIZE 10 ;
HELPBUTTON
SET HELPFILE TO 'HelpDemo.chm'
DEFINE MAIN MENU
POPUP '&File'
ITEM 'Open' ACTION MsgInfo('Open Click!')
SEPARATOR
ITEM 'Exit' ACTION Form_1.Release
END POPUP
POPUP '&Help'
ITEM '&Help ' ACTION DISPLAY HELP MAIN
ITEM '&Context' ACTION DISPLAY HELP CONTEXT IDH_0001
ITEM '&PopUp Help' ACTION DISPLAY HELP POPUP IDH_0002
SEPARATOR
ITEM '&About' ACTION MsgInfo ( MiniGUIVersion(), "About" )
END POPUP
END MENU
DEFINE STATUSBAR FONT 'MS Sans Serif' SIZE 9
STATUSITEM "F1 - Help" WIDTH 100
CLOCK
DATE
END STATUSBAR
@ 100,120 LABEL Label VALUE "Press F1..."
@ 150,100 BUTTON Button_1 ;
CAPTION 'Button_1' ;
ACTION MsgInfo('Click Button_1!') ;
HELPID IDH_0002
@ 200,100 BUTTON Button_2 ;
CAPTION 'Button_2' ;
ACTION MsgInfo('Click Button_2!') ;
HELPID IDH_0003
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil