F1 for Help in a Dialog with no menus?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

F1 for Help in a Dialog with no menus?

Christopher J. Demers
Does anyone know of an easy way to intercept an F1 key press (for dialog
context sensitive help) on a dialog with no menus?  The Dolphin development
tools do this via a menu, but my dialog will not have one.  I wonder if I
can accomplish this effect by creating and inserting a CommandDescription
somewhere in my dialog view?  Does this sound feasible, or am I barking up
the wrong tree?

Thanks,

Chris


Reply | Threaded
Open this post in threaded view
|

Re: F1 for Help in a Dialog with no menus?

Ian Bartholomew-4
Chris,

> Does anyone know of an easy way to intercept an F1 key press (for dialog
> context sensitive help) on a dialog with no menus?  The Dolphin
> development tools do this via a menu, but my dialog will not have one.  I
> wonder if I can accomplish this effect by creating and inserting a
> CommandDescription somewhere in my dialog view?  Does this sound
> feasible, or am I barking up the wrong tree?

In the past I've done something like the following. It appears, from a quick
try, to work in a menuless Dialog so should be worth a try. I'm not 100%
sure how legal it is though.

YourDialog>>onViewOpened
    | table |
    super onViewOpened.

    table := AcceleratorTable new.
    table
        addKey: VK_F1
        commandDescription: (CommandDescription command: #help).
    self view acceleratorTable: table

and then provide a #help, or whatever, method.

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: F1 for Help in a Dialog with no menus?

Christopher J. Demers
Ian Bartholomew <[hidden email]> wrote in message
news:9lc0ds$8je31$[hidden email]...

> In the past I've done something like the following. It appears, from a
quick
> try, to work in a menuless Dialog so should be worth a try. I'm not 100%
> sure how legal it is though.
...

Thanks Ian, it works like a charm!

Chris


Reply | Threaded
Open this post in threaded view
|

Re: F1 for Help in a Dialog with no menus?

Bill Schwab-2
In reply to this post by Ian Bartholomew-4
Ian,

> In the past I've done something like the following. It appears, from a
quick
> try, to work in a menuless Dialog so should be worth a try. I'm not 100%
> sure how legal it is though.

The phrase "menuless dialog" leaves me wanting to ask "aren't all dialogs
that way?"  Maybe it's a Win16 specific feature, but, I vaugely recall some
kind of overloading of the menu handle at some point.  I thought this
prevented dialogs from having menus.  Is this a bad cluster in my persistent
storage, something that's no longer true, or are you talking about something
else entirely?

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: F1 for Help in a Dialog with no menus?

Ian Bartholomew-4
Bill,

> The phrase "menuless dialog" leaves me wanting to ask "aren't all dialogs
> that way?"

I just meant in in the context of the original question. Probably better
written as "a Dialog without a main menu on which you can define a shortcut
key applicable to the whole Dialog" <g>

> Maybe it's a Win16 specific feature, but, I vaugely recall some
> kind of overloading of the menu handle at some point.  I thought this
> prevented dialogs from having menus.  Is this a bad cluster in my
> persistent storage, something that's no longer true, or are you talking
> about something else entirely?

A quick try at adding a menu bar to a Dialog seems to work as expected so if
it was prevented in the past it doesn't seem to be a restriction any more.

I also had a look in the image for examples of a Dialog subclasses using a
menu bar and the first I found was the MenuComposer class' default view -
which seemed quite appropriate is a funny sort of way!!

Regards
    Ian