-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gregory Hosler wrote:
> Hi all,
> 
> I have labels, which I wish to allow the user to select the text for the 
> purpose
> of cut/pasting. So I set
> 
>       gtk_label_set_selectable (GTK_LABEL (dlabel), 1)
> 
> on the label.
> 
> The problem I have now is that when the label is created, not only is the text
> selectable, but it is also SELECTED as an initial state. I would prefer for 
> the
> text to be selectable, BUT NOT selected (at least as a default state).
> 
> How might I turn off "selected" ?
> 
> any tips ?

After some exploring, and looking at the gtk samples, I have an answer.
I'm not happy with it. It seems (to me) like there is a bug, so let me
explain what works, and what doesn't work.

If I have a window (dwindow), and then create a label as follows:

        dlabel=gtk_label_new("");
        gtk_label_set_text(GTK_LABEL(dlabel), "my text");
        gtk_label_set_line_wrap(GTK_LABEL(dlabel),1);
        gtk_label_set_selectable (GTK_LABEL (dlabel), 1);

Then attach my label to the window and then:

        gtk_widget_show_all(dwindow);

My label will show up, as selectable, BUT the label text will be
initially selected.

If I change the above sequence to this:

        dlabel=gtk_label_new("");
        gtk_label_set_text(GTK_LABEL(dlabel), "my text");
        gtk_label_set_line_wrap(GTK_LABEL(dlabel),1);

Then attach my label to the window and then:

        gtk_widget_show_all(dwindow);
        gtk_label_set_selectable (GTK_LABEL (dlabel), 1);

i.e. setting the selectable attribute AFTER the label is realized,
created, etc. *then* the label text will NOT be selected (but it is
still selectable).

I do not understand why in one case the initial state of the text is
"selected" and in the 2nd case it is NOT "selected".

Is this a bug? Or is there a reason this is like this?

thoughts ?

thanks, in advance,

- -Greg

> many thanks in advance,
> 
> -Greg
> 

- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   [EMAIL PROTECTED]    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHGJiR404fl/0CV/QRAj4qAKDTE5kfVcrecQbw6arNLTKzy+uuxgCeMlio
xe7iq9VpJsuEOhOYYR5jeVE=
=ygKQ
-----END PGP SIGNATURE-----
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to