Reply
Thread Tools
Posts: 23 | Thanked: 8 times | Joined on Apr 2009 @ Germany
#1
Hello!

When running on regular PC, selected with mouse text in GtkEntry is "visible" to function gtk_editable_get_selection_bounds. I've tried
to run my application on Nokia N800 and there the selected with stylus text is not reported by this function. What is the trick to make this happen?

Also, what is the proper way to disable virtual keyboard show up when the input field gets focus?
 

The Following User Says Thank You to v_andal For This Useful Post:
Posts: 432 | Thanked: 645 times | Joined on Mar 2009
#2
Hi,

I haven't tried it by myself, but this function in the API should do it:

[1] GtkIMContext

and here an example how to use that. It is not exactly the same case but at least it shows the basic functionality I think:

[2] Example

I hope this helps you.

Cheers Daniel
 
Posts: 23 | Thanked: 8 times | Joined on Apr 2009 @ Germany
#3
Thank you for pointers to GtkIMContext, but big question is how to obtain the pointer to GtkIMContext.

Any hints about selection in the GtkEntry?
 
Posts: 23 | Thanked: 8 times | Joined on Apr 2009 @ Germany
#4
So far, I've managed to disable popping up of virtual keyboard. The trick is to add "focus-in-event" signal handler that returns TRUE. But it does not help against loosing the selection when focus is removed from the GtkEntry. I'll try to play with "focus-out-event", maybe here I can capture the selected text. It really puzzles me. Why the selection is lost with the focus loss under maemo?
 

The Following User Says Thank You to v_andal For This Useful Post:
Posts: 23 | Thanked: 8 times | Joined on Apr 2009 @ Germany
#5
The focus-out-event does not help. By the time it arrives the selection is already gone Amazingly enough, the selection is not lost when the GtkToolButton is clicked. So I could partly work around this problem by replacing regular buttons with the ones in toolbar, and partly with saving the selected area on the button-released event.

It would be interesting to see how the GtkToolButton is handled so that it does not disturb neither the focus nor the selection.
 

The Following User Says Thank You to v_andal For This Useful Post:
Posts: 23 | Thanked: 8 times | Joined on Apr 2009 @ Germany
#6
Uph. Looks like I've found the way to get desired behavior. First of all, to prevent focus stealing, the property "can-focus" on the button had to be set to FALSE. After that, instead of using "clicked" event I used signal "button-pressed-event" and inside of this handler the selection was still visible!
 

The Following 3 Users Say Thank You to v_andal For This Useful Post:
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#7
Maybe you already know, but 'clicked' means released. Keep up the good work.
__________________
N9: Go white or go home
 
Posts: 654 | Thanked: 664 times | Joined on Feb 2009 @ Germany
#8
Thanks v_andal! I just had the same problem. Using gtk_button_set_focus_on_click() to disable the focus did the trick. I even was able to use the normal "clicked" signal.
 
Reply


 
Forum Jump


All times are GMT. The time now is 13:30.