top shell event handlers ???

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
top shell event handlers ???

 

top shell event handlers ???
Submitted by Anonymous on Wed, 04/02/2003 - 21:49.

Hi ,

first of all thanks for replying for my first query!!!

the following code does nothing , can somebody help me in achieving the same.
_toplevel = XtVaAppInitialize(&_context, _Title, NULL, 0,
argc, argv, scale_res, NULL);

XtAddEventHandler(_toplevel, KeyReleaseMask, False, toplevelKeyReleaseEH, this);

...

....
void toplevelKeyReleaseEH(Widget w, XtPointer clientdata, XEvent *event, char* str)
{

XComposeStatus compose;
KeySym keysym;
int bufsize = 20;
char buffer[20];

XKeyEvent *keyEvent = (XKeyEvent*) event;

XLookupString(keyEvent, buffer, bufsize, &keysym, &compose);

if( (keysym == XK_Escape) || (keysym == XK_r) )
{
// My Statements
}

if(keysym >= XK_0 && keysym <= XK_9)
{
// My Statements
}

}

i want to handle key board events at the application level , can somebody help me out.

regards
ragu

 

Thu, 04/03/2003 - 01:28#1

Thu, 04/03/2003 - 01:28#1

ICS_support

top shell event handlers ???

It`s likely that the shell is never getting the events because they`re being grabbed by the widgets that are within the shell -- those that are visible, when the shell itself is effectively hidden by its descendants.

It`s really not clear what you want to do, but you should probably read about actions/translations, which offer a much cleaner version of the above code, and the Xt-level grabs, which give an application-wide method of handling keys.

 

Thu, 04/03/2003 - 14:16#2

Thu, 04/03/2003 - 14:16#2

Anonymous

top shell event handlers ???

Thanks ICS_Support

okay let me put it this way,

how do i handle keyboard events globally for an application.

My application has one topshell and 5 r sub shells (applicationShellWidget Class).

whose parent is ofcourse topshell.

i want to activate the escape key to call the expose callback of a drawing area widget , and wherein i have key handlers for the drawing area widget. i perform opengl display onto the drawing area.

regards
ragu