LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Tags used in this thread
Popular LQ Tags ,

Reply
 
Thread Tools
Old 04-14-2009, 08:24 AM   #1
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 507
Thanked: 22
GtkCheckButton - how to put label on the other side of the button?


[Log in to get rid of this advertisement]
Due to a very specific style guide for a project I have to adjust Gtk radio and checkbuttons to show their text label on the _left_ side of the button like this:

apple []
pears []
grape []

Gtks default puts the button on the left side and the textlabel on the right.

Did I miss some incredibly simple flag or do I have to derive a custom button from ToggleButton to archieve that? (If so - some illustrating pseudo code would be appreciated..)

I've tried some hack with not showing the default label of a radio/checkbutton and instead putting my own label on the left side - but as both button-types have a clickable area around them where usally the label is set, this is ugly and not really working.
Su-Shee is offline  
Tag This Post ,
Reply With Quote
Old 04-14-2009, 10:08 AM   #2
theNbomr
Senior Member
 
Registered: Aug 2005
Distribution: Open Suse, Fedora, Redhat
Posts: 2,274
Thanked: 74
I'm no expert on this subject, but I did play around with radio buttons in Glade, and can suggest a work-around. Make the radio button's label an empty string, and pack a separate label adjacent to it, all within a hbox. The relevant code generated by glade:
Code:
  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_table_attach (GTK_TABLE (table1), hbox3, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label1 = gtk_label_new (_("label1"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox3), label1, TRUE, TRUE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);

  radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, "");
  gtk_widget_show (radiobutton3);
  gtk_box_pack_end (GTK_BOX (hbox3), radiobutton3, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON(radiobutton3),radiobutton3_group);
  radiobutton3_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3));
Hoping someone comes up with a better solution.
--- rod.
theNbomr is offline     Reply With Quote
Old 04-14-2009, 10:59 AM   #3
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 507
Thanked: 22

Original Poster
That's what I did...

As mentioned it's not really that nice because of Gtk sets a clickable area around the label. This is very useful, because you don't have to acutally hit the (tiny) button itself but just the label to activate the check/radio button..

Now I have my clickable area still on the right side of my buttons and my label left-sided.

Here's a screenshot of some checkbuttons.

I could add an EventBox or something like this - but at least I'd like to disable the empty click area on the right side.
Su-Shee is offline     Reply With Quote
Old 04-22-2009, 08:34 PM   #4
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 80
Thanked: 1
You could change the size of the window, or modify the size of the columns and rows of your widgets. Also, you can set the labels so that they aren't "clickable", lol, i don't know if that's the right word. Anyways, hope that helps.
kike_coello is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse side button problems... vik Slackware 3 04-17-2008 11:22 PM
TeamSpeak2 - Logitech MX1000 - Side Button Push to Talk nutnut Linux - Software 1 08-14-2007 01:31 PM
SLED 10, Microsoft Wireless Notebook Optical Mouse 4000 and side button... Aleksej Linux - Hardware 0 03-29-2007 10:42 AM
button-widget's label text is cut in half xideum Linux - Software 0 10-02-2004 03:01 PM
Logitech Mouse: side button won't work hopper02 Linux - Hardware 0 11-21-2003 03:44 PM


All times are GMT -5. The time now is 12:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration