Page 1 of 1

Using of the help button of the titlebar

Posted: 27 Jul 2016 11:40
by Ferenc Nagy
The GUI provides two possibilities to provide help to a dialog:
1) Using the event handler of an ordinary button,
2) Using the Help button on the titlebar.

The first case is clear:
The onHelpClick event handler belonging to the help button has to display a help topic.

Code: Select all

help_ctl:setClickResponder(onHelpClick),           predicates     onHelpClick : button::clickResponder. clauses     onHelpClick(Source) = button::defaultAction :-        htmlHelp::invoke(T, fullFileName, htmlHelp::hh_help_context ,Id),        
Please write me the recipe for the usage of the help button on the titlebar that is

Code: Select all

the usage of the property helpResponder : helpResponder   of the interface framedecoration.  

Posted: 27 Jul 2016 14:34
by Gukalov
Hi.

Code: Select all

implement main   clauses     run() :-         _ = fignyaDLG::new().   end implement main   goal     main::run().   implement fignyaDLG     inherits dialog   clauses     new() :-         dialog::new(window::getActiveWindow()),         setDecoration(titlebar([helpButton, closeButton])),         helpResponder := {             (_, _) = true :-                  _ = shell_native::shellExecute(nullHandle, "open", "http://wiki.visual-prolog.com/", "", "", windowsAPI::sw_show) },         show().   end implement fignyaDLG   class fignyaDLG : dialog     open core   end class fignyaDLG

Help coding alternatives

Posted: 28 Jul 2016 8:13
by Ferenc Nagy
Gukalov wrote:

Code: Select all

        helpResponder := {             (_, _) = true :-                  _ = shell_native::shellExecute(nullHandle, "open", "http://wiki.visual-prolog.com/", "", "", windowsAPI::sw_show) },
Thank you, Gukalov.
Is the above fragment equivalent with the lines below?

Code: Select all

helpResponder(Source,ContextHelp) = true:-         _ = shell_native::shellExecute(nullHandle, "open", "http://wiki.visual-prolog.com/", "", "",      windowsAPI::sw_show).
When would you choose a [Help] button within the titlebar of a dialog, and when would you prefer a [Help] button within its client area?

I think that if you have narrow place for the client are then the Helpbutton in the titlebar is the better choice.
On the contrary, the big Help button is more user friendly.

Posted: 28 Jul 2016 10:36
by Gukalov
Clicking help button moves focus on this button - it nerves sometimes. Clicking titlebar button does not.
If use helpResponder, then pressing "F1" on keyboard works automatically.
Set contextHelpId for children and parent helpResponder will get "help events" from children with contextHelpId-S you set.

F1 and focus

Posted: 28 Jul 2016 11:15
by Ferenc Nagy
Hi,

If I understand your second answer well,
key F1 invokes automatically the help topic assigned to the help request but does not move the focus from the current control to the help button of the titlebar. This makes easier to define separate help topics for certain controls within the dialog, by checking the active control of the dialog.

When the Help button is one of the big visible buttons within the client area of the dialog the focus in on itself when the help request is processed, and the F1 button does not invoke the onHelp event handler automatically. The programmer has to define an onKey procedure calling the onHelp event handler.

Re: F1 and focus

Posted: 28 Jul 2016 11:22
by Gukalov
Ferenc Nagy wrote:Hi,
This makes easier to define separate help topics for certain controls within the dialog, by checking the active control of the dialog.
Yes. Definitely. Very impotant in case of 99... fields to fill in :)

Minimize and maximize buttons do not allow to appear the help button

Posted: 29 Jul 2016 17:44
by Ferenc Nagy
Hi Gukalov,
Try to add to the setDecoration call these Buttons.

Code: Select all

 setDecoration(titlebar([helpButton, closeButton,  maximizeButton,minimizeButton])),        
:-) The Help button will disappear.

This exclusion is not the single strange behavior of the setDecoration procedure or the Windows itslef.

Re: Minimize and maximize buttons do not allow to appear the help button

Posted: 29 Jul 2016 20:20
by Gukalov
Ferenc Nagy wrote:Hi Gukalov,
Try to add to the setDecoration call these Buttons.
...
:-) The Help button will disappear.
Of course I tried))) And tried some years ago already)))
Why is it like that ask Thomas)))

The contradicting arguments, display and working of the frame decoration

Posted: 30 Jul 2016 3:34
by Ferenc Nagy
The setDecoration(buttons) procedure allows four buttons in the list of decoration buttons.
In spite of it, not all 2^4 combinations are possible.
1) Both minimize button and maximize button must be present, xor misising.
2) They must be accompanied by the close button.
3) They inactivate the helpButton.

I could not solve the problem of uncloseable message window long ago specifying
[maximizeButton,minimizeButton].

I had to use

Code: Select all

buttons:=titlebar([closeButton,maximizeButton,minimizeButton]), % and pass denyClose() to setCloseResponder(...).
The lookout the result is strange:
The X of the close button is visible on the titlebar of the message window. When the cursor is over it the background color of the X changes to red but the user clicks on it in vain.

Re: The contradicting arguments, display and working of the frame decoration

Posted: 1 Aug 2016 12:52
by Gukalov
Ferenc Nagy wrote: 3) They inactivate the helpButton.
If helpResponer is set key "F1" works both with and without helpButton on titleBar. And without titleBar at all "F1" works.
It's almost good, it's good enough ;)

Posted: 7 Aug 2016 20:55
by Thomas Linder Puls
The question mark in the title bar is a Windows feature. It is also a Windows feature that the question mark cannot be combined with the minimize and maximize facilities.