Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Using of the help button of the titlebar

Unread post 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.  
TIA, Regards,
Frank Nagy
User avatar
Gukalov
VIP Member
Posts: 62
Joined: 5 Oct 2011 15:16

Unread post 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
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Help coding alternatives

Unread post 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.
TIA, Regards,
Frank Nagy
User avatar
Gukalov
VIP Member
Posts: 62
Joined: 5 Oct 2011 15:16

Unread post 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.
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

F1 and focus

Unread post 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.
TIA, Regards,
Frank Nagy
User avatar
Gukalov
VIP Member
Posts: 62
Joined: 5 Oct 2011 15:16

Re: F1 and focus

Unread post 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 :)
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

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

Unread post 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.
Attachments
single close button allows help.PNG
single close button allows help.PNG (20.55 KiB) Viewed 40944 times
minmax does not allow help.PNG
minmax does not allow help.PNG (8.75 KiB) Viewed 40944 times
TIA, Regards,
Frank Nagy
User avatar
Gukalov
VIP Member
Posts: 62
Joined: 5 Oct 2011 15:16

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

Unread post 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)))
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

The contradicting arguments, display and working of the frame decoration

Unread post 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.
Attachments
disabled close button.PNG
disabled close button.PNG (2.69 KiB) Viewed 40919 times
TIA, Regards,
Frank Nagy
User avatar
Gukalov
VIP Member
Posts: 62
Joined: 5 Oct 2011 15:16

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

Unread post 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 ;)
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post 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.
Regards Thomas Linder Puls
PDC
Post Reply