Re: Accessing context popup menues through keyboard



>I have an app that displays a GtkCTree which registers a signal handler
>for the button_press_event. When the signal handler is invoked, it
>checks to see if the x and y pixel coordinates are within a valid row in
>the GtkCTree (I use gtk_clist_get_selection_info() to verify). If so, I
>see if the event button was for the right mouse button. If so, I create
>a context popup at x,y for the row corresponding to x & y.
>
>This all works fine and dandy. I want to support using SHIFT-F10 to
>access the context menu for a row. I can set up a hander for
>"key_press_event" and recognize SHIFT + GDK_F10 just fine. But now what?

I'll come back to this later.

>The GdkEventKey doesn't provide x & y coordinates. How do I get the x &
>y coordinates during the "key_press_event"?

there are none, because a key event doesn't have any coordinates. use
gdk_window_get_pointer() but remember that under X, this requires a
round-trip to the X server, so don't put it into a tight loop.

>The whole point of allowing SHIFT-F10 is to attempt to make the app more
>accessible to folks with disabilities.

You have to make a choice here. Your initial design was based on using
button_press_event, which is inextricably tied to use of a mouse. Now
you've decided to let them do the same thing with Shift-F10. But what
is the "same" thing? Its carrying out some operation based on a
particular row. But which row? In the button press case, it was the
row that was clicked. But there is no such "clicked" row in the case
of Shift-F10. All there is the currently selected row, which you keep
track of with the "select_row" event. You don't need x,y coordinates
for this.

--p




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]