Re: On Click event for an image

>From: Russell Shaw <rjshaw netspace net au>
>Chris W wrote:
>> I am thinking that the best way to get the look I want for the 
>> calculator simulator I want to create is to have one graphic for 
>> keyboard.  So I need to respond to clicks and then know where on the 
>> image they clicked so I can then figure out what button is at that 
>> point.    How do you do that?
>Read the button-press coordinates from a GtkDrawingArea that has a
>picture of the keypad on it. You'll need to manually define where
>the hot areas for each button lie.

Have another image of the same size than the calculator keyboard
image. Code the number and operation keys to color codes. Get the
coordinates from GtkDrawingArea and check the color code from the
another image. Convert the color code to key.

If you make the keyboard image with image manipulation software
(like GIMP), it should be easy to select the color codes and
paint over the keys. Select the colors numerically. You may
check the color numbers from the ascii table.


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