Re: Click (GDK_BUTTON_PRESS & _RELEASE) in GDK



    Vassilios> Hi all!  Here is my problem: I am drawing objects on a drawing
    Vassilios> area and process GDK_BUTTON_PRESS and GDK_BUTTON_RELEASE events
    Vassilios> in it; however I would like to have a third type of event like
    Vassilios> "BUTTON_CLICK" (_PRESS immediately followed by a _RELEASE).
    Vassilios> For example, "_CLICK" would just select an object, while _PRESS
    Vassilios> would start moving an object till a _RELEASE is encounterd.

    Vassilios> It there a simple way to do this?

Yes.  Before processing the BUTTON_RELEASE, compare the time value in the
event to the time value in the last event.  If the value is below some number,
process it as though it were a "_CLICK."

This usually means that you have to change the way you deal with BUTTON_PRESS
a little bit.
-----------------------------------------------------------------------------
Mark Leisher
Computing Research Lab            Cinema, radio, television, magazines are a
New Mexico State University       school of inattention: people look without
Box 30001, Dept. 3CRL             seeing, listen without hearing.
Las Cruces, NM  88003                            -- Robert Bresson




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