Re: Question on gtk_label_set_selectable

2007-10-20 Thread Chris Vine
On Fri, 2007-10-19 at 16:54 +0200, Gian Mario Tagliaretti wrote:
 2007/10/19, David Nečas (Yeti) [EMAIL PROTECTED]:
  On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
  
   You can also set the can-focus property to FALSE on the label which
   will be still selectable.
 
  Not exactly.  It will be only selectable *with mouse*.
 
 Good point David, I didn't think of that.

GtkEntry has a gtk-entry-select-on-focus property to deal with this.
Probably GtkLabel should have a similar property - it might be worth
submitting a bug/feature report.

Chris


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Question on gtk_label_set_selectable

2007-10-20 Thread Chris Vine
On Sat, 2007-10-20 at 10:11 +0100, Chris Vine wrote:
 On Fri, 2007-10-19 at 16:54 +0200, Gian Mario Tagliaretti wrote:
  2007/10/19, David Nečas (Yeti) [EMAIL PROTECTED]:
   On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
   
You can also set the can-focus property to FALSE on the label which
will be still selectable.
  
   Not exactly.  It will be only selectable *with mouse*.
  
  Good point David, I didn't think of that.
 
 GtkEntry has a gtk-entry-select-on-focus property to deal with this.
 Probably GtkLabel should have a similar property - it might be worth
 submitting a bug/feature report.

Actually, on looking it up, I see that there is this property
available, via the GtkSettings object - see gtk-label-select-on-focus
at http://library.gnome.org/devel/gtk/unstable/GtkSettings.html .

The following should do the trick, if the behaviour is wanted on an
application wide basis:

GtkSettings* settings = gtk_settings_get_default();
if (settings) {
  g_object_set(settings,
   gtk-label-select-on-focus, FALSE,
   NULL);
}

Chris


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Question on gtk_label_set_selectable

2007-10-20 Thread Gregory Hosler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chris Vine wrote:
 On Sat, 2007-10-20 at 10:11 +0100, Chris Vine wrote:
 On Fri, 2007-10-19 at 16:54 +0200, Gian Mario Tagliaretti wrote:
 2007/10/19, David Nečas (Yeti) [EMAIL PROTECTED]:
 On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
 You can also set the can-focus property to FALSE on the label which
 will be still selectable.
 Not exactly.  It will be only selectable *with mouse*.
 Good point David, I didn't think of that.
 GtkEntry has a gtk-entry-select-on-focus property to deal with this.
 Probably GtkLabel should have a similar property - it might be worth
 submitting a bug/feature report.
 
 Actually, on looking it up, I see that there is this property
 available, via the GtkSettings object - see gtk-label-select-on-focus
 at http://library.gnome.org/devel/gtk/unstable/GtkSettings.html .
 
 The following should do the trick, if the behaviour is wanted on an
 application wide basis:
 
 GtkSettings* settings = gtk_settings_get_default();
 if (settings) {
   g_object_set(settings,
gtk-label-select-on-focus, FALSE,
NULL);
 }
 
 Chris

Many thanks to all who responded on this question!

best rgds,

- -Greg

_
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


- --
+-+

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)

iD8DBQFHGsWl404fl/0CV/QRAhuTAJ9DAukd8+fgQLSU0hKBt+Bgx4NF2wCgr0N4
qMjynNzkzU6O+TznIuDVg74=
=UeZ6
-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

Re: Question on gtk_label_set_selectable

2007-10-19 Thread Gian Mario Tagliaretti
2007/10/19, David Nečas (Yeti) [EMAIL PROTECTED]:
 On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
 
  You can also set the can-focus property to FALSE on the label which
  will be still selectable.

 Not exactly.  It will be only selectable *with mouse*.

Good point David, I didn't think of that.

cheers
-- 
Gian Mario Tagliaretti
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Yeti
On Fri, Oct 19, 2007 at 03:06:55PM +0200, Gian Mario Tagliaretti wrote:
 
 You can also set the can-focus property to FALSE on the label which
 will be still selectable.

Not exactly.  It will be only selectable *with mouse*.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Gian Mario Tagliaretti
2007/10/19, David Nečas (Yeti) [EMAIL PROTECTED]:

 Your label the first widget in the window that accepts focus
 (selectable labels can receive focus, unlike normal labels).
 Therefore the label will get focus, which selects its text
 -- at least this seems to be the default behaviour.

 If you add the label after it's decided which widget should
 receive focus, the label does not get focus and therefore
 its text is not selected.

You can also set the can-focus property to FALSE on the label which
will be still selectable.

cheers
-- 
Gian Mario Tagliaretti
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Gregory Hosler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Ne?as (Yeti) wrote:
 On Fri, Oct 19, 2007 at 07:44:19PM +0800, Gregory Hosler wrote:
 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 ?
 
 I have not seen the code, but...
 
 Your label the first widget in the window that accepts focus
 (selectable labels can receive focus, unlike normal labels).
 Therefore the label will get focus, which selects its text
 -- at least this seems to be the default behaviour.
 
 If you add the label after it's decided which widget should
 receive focus, the label does not get focus and therefore
 its text is not selected.

interesting thought.

The label is in a dialog box with one or 2 buttons. I guess I need to
put the focus onto the default button.

I'll give that a try, and see what happens.

Thanks,

- -Greg

 Yeti
 
 --
 http://gwyddion.net/
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


- --
+-+

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

iD8DBQFHGKrz404fl/0CV/QRAhwRAJ9fMZr0G0o4h7sK88MVP7t9bi+SxACfdqcx
wxwm32RQGTyNbIX8+JCgNsc=
=EJwv
-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


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Yeti
On Fri, Oct 19, 2007 at 07:44:19PM +0800, Gregory Hosler wrote:
 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 ?

I have not seen the code, but...

Your label the first widget in the window that accepts focus
(selectable labels can receive focus, unlike normal labels).
Therefore the label will get focus, which selects its text
-- at least this seems to be the default behaviour.

If you add the label after it's decided which widget should
receive focus, the label does not get focus and therefore
its text is not selected.

Yeti

--
http://gwyddion.net/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question on gtk_label_set_selectable

2007-10-19 Thread Gregory Hosler
-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