Re: nuts!
On 07/28/2014 11:00 PM, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. well, I've been at this for more than 9 hours. almost nonstop. need the list's help. while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: 1. label1 text, blah**3. 2 label2 text: whatever . . . N. LabelN: text: more label strings ?? I have googled here and there. only one of my foobar.c files *seems* to print from the left. (there is lots more to this test; getting the list of labels or strings neatly printed is only the start.) thanks, gary (Sorry Gary - you get this twice, the first time I forgot to reply to the list and not just to you) If I have a good enough understanding of what you want to do... Set the label to horizontally expand so it fills the whole width of the container you place it in. Since labels are derived from gtk_misc, you can then set how the label positions the text within its area. -- Tony ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
It's actually gtk_*label*_set_justify (). On 07/29/14 15:22, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 03:37:03PM -0400, Chris Moller wrote: It's actually gtk_*label*_set_justify (). noted; thanks. On 07/29/14 15:22, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 03:37:03PM -0400, Chris Moller wrote: It's actually gtk_*label*_set_justify (). POST LAST SCRIPT, :):: I came across something like the allignment + [[i thought]], 0,0,0,5. I Did Not understand it after 7 or 8 hours. that was when I backed away from the computers and sacked out. ...i just cd'd to ~/devel and greped for justify. Zip. On 07/29/14 15:22, Gary Kline wrote: = Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 10:36:03AM +0100, Chris Vine wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Chris thanks to you and tony newman, both. you included what I needed most: code! so far I don't believe I've used gtk_set_justify; I appreciate the tip. I'll google up the function for v 3.0 if it's still there but would I justify separate labels (say: label1, label2, label3 OR label[i]? BTW, if I seem a bit dense about GTK+, it's because I graduated in 1982... barely audio back then! gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
On Tue, Jul 29, 2014 at 6:36 AM, Chris Vine ch...@cvine.freeserve.co.uk wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Note that since GTK+-3.0 there are the 'halign' and 'valign' properties of GtkWidget which accomplish the same as setting the GtkMisc alignment properties. These are preferred and the GtkMisc API, while not officially deprecated, is not recommended for use in new code[0]. Instead, you should be able to use: gtk_widget_set_halign (label, GTK_ALIGN_START); This should align whatever widget to the left of the available space for the given widget (or to the right in RTL mode) - this API can also be used for any widget (it is not limited to GtkMisc derived widgets). Cheers, -Tristan [0]: https://developer.gnome.org/gtk3/stable/GtkMisc.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: nuts!
= Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 28 years of service to the Unix community. On Tue, Jul 29, 2014 at 08:06:24PM -0003, Tristan Van Berkom wrote: On Tue, Jul 29, 2014 at 6:36 AM, Chris Vine ch...@cvine.freeserve.co.uk wrote: On Mon, 28 Jul 2014 23:00:34 -0700 Gary Kline kl...@thought.org wrote: while I can create several {N} labels, they print centered. how do I get the labels to print from the left side of the window widget: Use 'gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5)' to align left, and 'gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5)' to align right. For multi-line labels, you would also want to call gtk_set_justify(). Note that since GTK+-3.0 there are the 'halign' and 'valign' properties of GtkWidget which accomplish the same as setting the GtkMisc alignment properties. These are preferred and the GtkMisc API, while not officially deprecated, is not recommended for use in new code[0]. Instead, you should be able to use: gtk_widget_set_halign (label, GTK_ALIGN_START); This should align whatever widget to the left of the available space for the given widget (or to the right in RTL mode) - this API can also be used for any widget (it is not limited to GtkMisc derived widgets). Cheers, -Tristan [0]: https://developer.gnome.org/gtk3/stable/GtkMisc.html I'm going over the url you gave. I got up super early today for my daughter who is going to study comp-sci this fall(!); so I really do need more coffee or a *nap*. meanwhile, below is a testfile that print N labels [[ here N == 3 ]]. Id send you the makefiles, but figure you can mouse the gcc line. x2 is my lack of imagination. at any rate, iv'e used the GTK__MISC string--macro? everything I'm coding from now on is 3.0, so could you edit in the recommended way? you've got halign; shouldn t I use the valign for mmy labels? tx much, gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Twenty-eight years of service to the Unix community. #include stdio.h #include gtk/gtk.h /*** gcc -Wall -g x2.c -o x2 `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` ***/ int main(int argc, char *argv[]) { GtkWidget *window, *vbox; // Labels go in here, vertically orientated. GtkWidget *label1, *label2, *label3; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 900); gtk_window_set_title(GTK_WINDOW(window), Labels Left-Margins); gtk_container_set_border_width(GTK_CONTAINER(window), 10); g_signal_connect(window, destroy, G_CALLBACK(gtk_main_quit), NULL); label1 = gtk_label_new(1: This is the file name named talk.1.txt); gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); // left label2 = gtk_label_new(2: This is talk.2.txt); gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5); // left label3 = gtk_label_new(3: File talk.3.txt for the speech impaired.); gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); // left vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label3, FALSE, TRUE, 0); gtk_widget_show_all (window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list