LinuxQuestions.org
Visit Jeremy's Blog.
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


Reply
  Search this Thread
Old 11-28-2003, 09:07 PM   #1
Claus
Member
 
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

Code:
 do{
                        switch(acl_rights[count]){
                                case 'l':
                                        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(checkbutton_l), TRUE);
                                        break;
...
But i get this message when i run and the program goes through that code...

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
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 57
Try:

gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_l));

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
Claus
Member
 
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Original Poster
Rep: Reputation: 15
thank you.
 
  


Reply


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration