GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Nov 24, 2014 8:14 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: appareance of the last active button GTK
PostPosted: Wed Dec 12, 2012 2:51 pm 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 37
Hello!
I have 4 buttons in a dialog.
They are all active but the last one which has been clicked lights blue (see attached picture)
Is it possible to deactivate this blue area on the button?

Thanks a lot in advance
MBoerner


Attachments:
button.jpg
button.jpg [ 1.79 KiB | Viewed 732 times ]
Top
 Profile  
 
 Post subject: Re: appareance of the last active button GTK
PostPosted: Wed Dec 12, 2012 6:52 pm 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
You don't say which version of GTK+ you're using but I'll assume it's GTK+3.x because of the rounded corners on the buttons.
Are these button's or toggle buttons?
Have you used CSS in your code?
Please post your code.

These examples I posted may be helpful:
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72090=GTK3+CSS+Buttons#p72090
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72091=GTK3+CSS+Buttons#p72091


Top
 Profile  
 
 Post subject: Re: appareance of the last active button GTK
PostPosted: Wed Dec 12, 2012 10:58 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
This particular look is determined by the theming of the OS/dstribution you are using. GTK3 uses cascading style sheets (http://developer.gnome.org/gtk3/stable/GtkCssProvider.html) which operate on varying levels of priorities at different layers (defined by the OS, display manager, user, and application). To have a look at what your setup is doing have a look at the files $XDG_CONFIG_HOME/gtk-3.0/gtk.css, $HOME/.themes/theme-name/gtk-3.0/gtk.css, and datadir/share/themes/theme-name/gtk-3.0/gtk.css (where theme-name is replaced by your current theme, e.g. Ambiance, and datadir is the prefix configured when GTK+ was compiled, e.g. /usr). An application can override existing settings, but this is almost always a really bad idea unless you are performing a thorough application wide overhaul of your styling. In your case there is something with your current style you don't like and though you might make compensatory measures to fix it for your particular system, on someone else's system without this feature, the compensatory measures are likely going to completely bugger up the styling.
Just remember that it is not just your application, but all gtk applications running on your system that will have this feature. If you still have a personal aversion to the lingering blue area, your best bet is to change to a different theme that you are more comfortable with.


Top
 Profile  
 
 Post subject: Re: appareance of the last active button GTK
PostPosted: Thu Dec 13, 2012 12:44 am 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 177
Location: USA
What OS/distribution are you using ?
What version of GTK+ are you using?

"Theming GTK3 widgets with CSS" from the Desktop Summit.

Quote:
When an app needs to force an unique look altogether...
  • Pro-oriented (e.g. Ardour)
  • Games, educational or unconventional
  • Special accessibility requirements

Ardour is multichannel digital audio workstation software: ardour.org

https://desktopsummit.org/sites/www.desktopsummit.org/files/Theming%20GTK3%20Widgets%20with%20CSS.pdf


Top
 Profile  
 
 Post subject: Re: appareance of the last active button GTK
PostPosted: Thu Dec 13, 2012 7:50 am 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 37
Sorry,
I use GTK 2 and the rounded buttons come from the customized theme "clearlooks"
OS is Ubuntu 10.4.1
I don't use CSS
The button are normal gtk buttons; I made them with
button = gtk_button_new_with_label(strlabel);
gtk_widget_set_size_request(GTK_WIDGET(button), STEP_BUTTON_WIDTH, STEP_BUTTON_HEIGHT);
gtk_button_set_relief (GTK_BUTTON(button), GTK_RELIEF_NORMAL);


Thanks for the answers


Top
 Profile  
 
 Post subject: I found it
PostPosted: Thu Dec 13, 2012 8:10 am 
Offline
Familiar Face

Joined: Fri Oct 26, 2012 10:49 am
Posts: 37
sorry, it was very simple: I just had to set the "can-focus" property to false.
The buttons just illustrate some digital outputs, and in this function, they don't need to be active.
Thank you for your links, i will read them.
MBoerner


Top
 Profile  
 
 Post subject: Re: appareance of the last active button GTK
PostPosted: Thu Dec 13, 2012 9:05 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Was panicking until I read that they were only for output, in which case disabling focus is definitely the right thing to do. Hopefully disabling focus will also prevent any visual clicking of the button.
Another option is to use something like a GtkLabel placed inside a GtkFrame (none of which are input widgets and get focus by default).
If you're sticking with a button for display, then because this is quite non-standard and gtk isn't fully aware its for output only, it might be a good idea to set the accessible name/description/role/relationship etc. of the widget so it doesn't confuse anyone using assistive technologies. E.g.:
Code:
AtkObject* atk_butt;
GtkWidget *button, *source;
...
atk_butt=gtk_widget_get_accessible(button);
atk_src=gtk_widget_get_accessible(source);
atk_object_set_description(atk_butt, "Digital output for channel 2");
atk_object_set_role(atk_butt, ATK_ROLE_TEXT);//otherwise the role would still be something like PUSH_BUTTON
atk_object_add_relationship(atk_butt, ATK_RELATION_CONTROLLED_BY, atk_src);
atk_object_add_relationship(atk_src, ATK_RELATION_CONTROLLER_FOR, atk_butt);

Don't know exactly what would best fit your purposes. Have a look at http://developer.gnome.org/atk/unstable/AtkObject.html for a description of the different roles and relationships (LABEL, LABEL_FOR and LABELLED_BY are the most common ones i have to use - see http://developer.gnome.org/accessibility-devel-guide/3.0/gad-coding-guidelines.html.en for examples on other cases where it s good to set up atk functions - though personally the _add_relationship function I use above is a much neater way of doing it than their example).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group