Re: How to detect Mouse Click Modifiers



"Srinivasan, Rajagopalan  \(IndSys, SalemVA\)" <Rajagopalan Srinivasan indsys ge com> writes: 
a) I am looking to detect whether the CTRL or ALT keys are pressed on a
"clicked" event. Essentially I am looking to trap CTRL/Left Mouse Click as
an example. Any ideas on how to do this?

"clicked" is a signal not an event in GTK terminology. If you want to
know the modifiers, you need to use events. Some signals give you
notification of an incoming event (which is why the difference is
confusing). The signal you want here is button_press_event, which
notifies you of a button press event.

Then use the "state" field in GdkEventButton.

"clicked" is actually emitted on button release IIRC, so if
synchronizing with that signal is important, maybe you want
button_release_event. If you connect() to the event, your handler will
be called before emitting "clicked", if you connect_after(), it will
be called after emitting "clicked" (because "clicked" is emitted in
the default handler for the event signal).

b) Is there a way to associate a "tooltip" with each line in a "clist"
widget? I was able to do this in a plain old "list" widget but with "clist"
it is not too clear.

No. The only thing you can do is manually track mouse motion events on
the clist and pop up a tooltip-like window manually.

c) Without being too elaborate, I am looking to enable fairly simple
hyperlinking in a text like widget. In other words, I would like to render a
page consisting basically text (source code if it matters) and then be able
to navigate on select text (eg external function names for instance). Is
Text the wrong vehicle?


Yeah, basically GtkText isn't good enough for this. The new
all-singing text widget in GTK 2 (which will be out soon, really, we
hope) does this and many more things. For now I would use one of the
third party text widgets such as GtkExText.

Havoc






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