Re: [gtk-list] Drawing area question




Peter Schoefer <ps@snafu.de> writes:

> Hello,
> 
> I am writing a tool for Dynamical Systems visualization, similar to DSTool
> (from
> ftp://macomb.cam.cornell.edu/pub/dstool/Version_tk/dstool_tk.tar.gz).
> 
> One of my problems comes from the limitation of the adjustment widget to
> floats. This restricts all input widgets which are based on adjustments
> (sliders, spinbuttons, ...) to 6 digits precision, which make them
> unusable 
> for many tasks where small perturbations of given numbers (one basic        
> question in numerical data analysis) are envolved.
>
> So a suggestion/wish:
> Changing adjustments and some derived widgets to double would increase
> the usefulness without breaking too much code (as far as I can see).

Hmmm, makes sense. It should be a source compatible change...

> My second problem has to do with the DrawingArea widget. I wrote a simple    
> mouse controled rubberbox for zooming which works without problems.
> I addition I want to do some fine positioning of the box with the cursor
> keys
> (as in xv), but I can't get any key_press_events from the drawing area and  
> can't figure out whats the reason. Maybe someone can give me some hints
> how to
> deal with this problem.

There are several things that might be happenning:

 - You need to call gtk_widget_set_events() (you probably already
   are doing this if you are getting mouse events)

 - You need to make sure that the drawing area gets the focus. 
   That means:
  
    GTK_WIDGET_SET_FLAGS (darea, GTK_CAN_FOCUS);
    gtk_widget_grab_focus (darea);

   You probably should also track focus_in and focus_out events
   and draw a focus-border around the drawing area so the user
   knows what is going on if they tab the focus away from the
   drawing area.

Regards,
                                   Owen




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