Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 9 of 9)
Section - 305) How do I make context sensitive help? The Motif Style Guide

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]


Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 304) How do I use imake with Motif 2.0?
Next Document: 306) How do I debug a modal interaction?
See reader questions & answers on this topic! - Help others by sharing your knowledge
says that an application must initiate context-sensitive help by changing the
shape of the pointer to the question pointer. When the user moves the pointer
to the component help is wanted on and presses BSelect, any available context
sensitive help for the component must be presented, and the pointer reverts
from the question pointer.
[Last modified: August 92]

Answer: A widget that gives context sensitive help would place this help in
the XmNhelpCallback function. To trigger this function: (from Martin G C
Davies, mgcd@se.alcbel.be)

I use the following callback that is called when the "On Context" help
pulldown menu is selected. It does the arrow bit and calls the help callbacks
for the widget. It also zips up the widget tree looking for help if needs be.
I don't restrict the arrows motion so I can get help on dialog boxes. No
prizes for guessing what "popup_message" does.


static void ContextHelp(
Widget          w ,
Opaque          * tag ,
XmAnyCallbackStruct     * callback_struct
)
{
static Cursor   context_cursor = NULL ;
Widget      context_widget ;

if ( context_cursor == NULL )
context_cursor = XCreateFontCursor( display, XC_question_arrow ) ;

context_widget = XmTrackingLocate( top_level_widget,
                        context_cursor, FALSE ) ;

if ( context_widget != NULL ) /* otherwise its not a widget */
{
XmAnyCallbackStruct cb ;

cb.reason = XmCR_HELP ;
cb.event = callback_struct->event ;

/*
 * If there's no help at this widget we'll track back
   up the hierarchy trying to find some.
 */

do
{
    if ( ( XtHasCallbacks( context_widget, XmNhelpCallback ) ==
                                        XtCallbackHasSome ) )
    {
        XtCallCallbacks( context_widget, XmNhelpCallback, & cb ) ;
        return ;
    }
    else
        context_widget = XtParent( context_widget ) ;
} while ( context_widget != NULL ) ;
}

popup_message( "No context-sensitive help found0or the selected object." ) ;
}


Dave Bonnett suggested, to use the following translations for XmText (and
XmTextField) widgets to get the same help with key strokes, and to provide an
accelerator label in the Context help menu entry.

MyApp*XmText*translations: #override\n\
                        <Key>F1:    Help()

MyApp*Help_menu*Contextual Help.acceleratorText:   F1

MyApp*defaultVirtualBindings:           osfBackSpace : <Key>Delete\n\
                                osfRight : <Key>Right\n\
                                osfLeft  : <Key>Left\n\
                                osfUp    : <Key>Up\n\
                                osfHelp  : <Key>F1\n\
                                osfDown  : <Key>Down


User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 304) How do I use imake with Motif 2.0?
Next Document: 306) How do I debug a modal interaction?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM