RE: clipboard pasted text highlighting broken?
- From: "Dugas, Alan" <alan dugas analog com>
- To: "Dugas, Alan" <alan dugas analog com>, Havoc Pennington <hp redhat com>
- Cc: gtk-app-devel-list gnome org, gtk-list gnome org
- Subject: RE: clipboard pasted text highlighting broken?
- Date: Mon, 16 Oct 2000 14:56:27 -0400
Hmm,,, I see what your saying. However, if I understand you correctly, I
may have found a hack that works but shouldn't. If I insert the following
line;
/* Creating entry widget to input search string */
entry = gtk_entry_new();
gtk_signal_connect(GTK_OBJECT(entry), "activate",
GTK_SIGNAL_FUNC(find_string), GTK_WIDGET(entry));
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(entry), FALSE, FALSE, 0);
gtk_editable_paste_clipboard(GTK_EDITABLE(GTK_ENTRY(entry)));
gtk_entry_append_text(GTK_EDITABLE(GTK_ENTRY(entry)), " ");
gtk_editable_select_region(GTK_EDITABLE(GTK_ENTRY(entry)), (gint) 0,
(gint) -1);
gtk_widget_show(entry);
all of the text in the gtkentry gets selected/highlighted properly!?!?!?
But wouldn't that mean it's somehow forcing the conditions mentioned below.
Havoc/Owen, does this hack make sense to either of you?
-- Stupid Genius
----------
From: Havoc Pennington[SMTP:hp redhat com]
Sent: Monday, October 16, 2000 1:48 PM
To: Dugas, Alan
Cc: gtk-app-devel-list gnome org; gtk-list gnome org
Subject: Re: clipboard pasted text highlighting broken?
"Dugas, Alan" <alan dugas analog com> writes:
/* Creating entry widget to input search string */
entry = gtk_entry_new();
gtk_signal_connect(GTK_OBJECT(entry), "activate",
GTK_SIGNAL_FUNC(find_string), GTK_WIDGET(entry));
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(entry), FALSE, FALSE, 0);
gtk_editable_paste_clipboard(GTK_EDITABLE(GTK_ENTRY(entry)));
gtk_editable_select_region(GTK_EDITABLE(GTK_ENTRY(entry)), (gint) 0,
(gint) -1);
gtk_widget_show(entry);
There are a couple problems with this code:
a) you can't paste from the clipboard until the entry is realized,
because the entry won't receive the selection-related events
b) paste_clipboard is asynchronous; what happens immediately is that
GTK requests the data from the clipboard, then sometime later
after the event loop runs the data is actually received and
inserted
So maybe what you want to do instead is connect_after() to the
selection_received signal; this signal is emitted when the clipboard
data actually arrives, and its default handler inserts the text, so if
you connect_after() your code will run after the text is inserted. Be
careful not to rely on receiving the selection after requesting it;
the app that owns it could crash, for example.
Havoc
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]