Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 11-28-2003, 09:07 PM   #1
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Rep: Reputation: 15
Enable/Disable GTk CheckButton

How can i enable/disable a GtkCheckButton ??

i was trying with this

                                case 'l':
                                        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(checkbutton_l), TRUE);
But i get this message when i run and the program goes through that code...

 (gyrus:20019): GLib-GObject-WARNING **: invalid cast from `GtkCheckButton' to `GtkCheckMenuItem'
(gyrus:20019): Gtk-CRITICAL **: file gtkcheckmenuitem.c: line 205 (gtk_check_menu_item_set_active): assertion `GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed
and off course, the checkbutton dont get activated...

So anyone can tell me how it's really supposed to be done??? Thank you..
Old 11-30-2003, 08:43 AM   #2
LQ Guru
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 57


You see, GtkCheckMenuItem is a different class to GtkCheckButton (one is a tick box, one is a menu item), and you are attempting to typecast between them which is invalid, hence the assertions. GtkCheckButton doesn't have its own way to toggle on and off, but it inherits from GtkToggleButton which does, hence you need gtk_toggle_button_* stuff.

Hope that helps
Old 12-01-2003, 04:44 AM   #3
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Original Poster
Rep: Reputation: 15
thank you.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Disable/Enable network interface Edwardml Mandriva 5 10-19-2005 10:00 AM
looking for a enable/disable mouse command to X samel_tvom Linux - Hardware 2 03-03-2005 11:00 AM
enable disable Tuttle General 0 01-08-2005 04:21 PM
disable ethernet, enable wireless Ryan450 Linux - Wireless Networking 1 09-17-2004 04:53 PM
how to disable sendmail and enable postfix? JM_Fraser Linux - Software 6 11-28-2003 07:15 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:16 AM.

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