Re: Scrollbars, multikey characters, Cut/paste... Hard prbs...



Paul Cheyrou <Paul Cheyrou-Lagreze inrialpes fr> writes:

Hi all,

As we're stuck for sometimes in those problems,
I'd like to konw if someone already had those type of problem or got tricks 
to help us, in GTK 1.2 :

1) SCROLLBARS:

When my app begins, 
My resize code is executed but my scrollbars doesn't reflect my app until I 
move the cursor out of the page or resize the page.

/* this is the resize code */
tmpw = (GtkAdjustment *)gtk_object_get_data (GTK_OBJECT(hscroll), 
"Adjustment");

Most people would do:

 gtk_range_get_adjustment (GTK_RANGE (hscroll));

Rather than attaching it as object data ;-)

       tmpw->lower = 0;
       tmpw->upper = l;
       tmpw->page_size = width;
       tmpw->page_increment = Xpos-13;
       tmpw->step_increment = 13;
       tmpw->value = Xpos;
       gtk_widget_show_all (GTK_WIDGET(hscroll));
       gtk_widget_queue_draw (GTK_WIDGET(hscroll));

It is connected with value_changed
Any Idea ?

Well, if you have to call queue_draw() on a widget, you are doing
something wrong. Widgets in GTK+ will generally know when
to redraw themself. 

Without seeing a bit more of the code, it's hard to know what is going
wrong.

 - Are you trying to act as the "parent" widget for the scrollbar
   yourself or are you using an existing container?

 - If you are changing the values of the adjustment, are you
   calling gtk_adjustment_changed() / gtk_adjustment_value_changed()
   in order to notify listeners (like the scrollbar) of the change?
 
2) Multikey charachters

When user wanna enter a character like ï, î or é è à
that needs to press two keys one by one, it doesn't work at all :
My app display the circumflexe glyph and then the normal carachter instead of 
To enable XIM support (which is how compose key handling works
in X), you need to do some extra work. The GtkEntry and GtkText
widgets can server as examples of this, though they are a little
more complicated than you need to _just_ handle compose, because
they are also handling over-the-spot input-method-feedback for
CJK.

(That is, when you enter Japanese, you enter a whole phrase
phonetically, then select characters corresponding to the
individual pieces.)

Search for gdk_im_* and gdk_ic_* in gtkentry.c to find the 
relevant pieces of code.

GTK+-1.3.x has a nicer input method abstraction, where you
create a GtkIMContext object, feed it keystrokes, then get
::commit signal when it has output.

joining them.
I've done all set_local and so on stuff I can, but it doesn't work...

Any Idea ?

3) Copy, Cut&paste directly in GTK instead of an actual X cut&paste :
I've found this, but doesn't apply much in my architecture app,
http://www.gtk.org/tutorial/sec-retrievingtheselection.html and
http://www.gtk.org/tutorial/sec-supplyingtheselection.html,
Is There another way to manage it ?

The selection primitives in GTK+ are very general, and should work
for just about any usage, though they aren't necessarily convenient.
Sometimes it's handy to use a GtkInvisible widget as the 
owner of the selection if there is no obvious widget to act
as the owner of the selection.

GTK+-1.3.x contains a GtkClipboard API that hides the GtkSelection
code and is considerably easier to use.

Regards,
                                        Owen




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