GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Nov 23, 2014 12:15 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: 2Q: how to change window contents and GnomeUIINFO
PostPosted: Fri Aug 10, 2012 7:14 pm 
Offline
Familiar Face

Joined: Tue Nov 29, 2011 7:59 pm
Posts: 11
Hello, everyone. I have 2 problems:

1) How I can change window contents on the fly? I want to remove unwanted widgets and add new widgets.

2) In my program I create menu using GNOMEUIInfo. For example:

Code:
...
static GnomeUIInfo filemenu[] = {
   GNOMEUIINFO_MENU_OPEN_ITEM (callback_function, my_data)
};
...
static GnomeUIInfo menubar [] ={
   GNOMEUIINFO_MENU_FILE_TREE (filemenu),
   GNOMEUIINFO_END
};

int main(argc, char *argv[])
{
...
gnome_app_create_menus(GNOME_APP(app), menubar);
...


I understand how I can set callback function for menu item, but how i can set data to this callback function? (For example, I want to open file which contains some data, which I want to display in main window).

Thank you!


Top
 Profile  
 
 Post subject: Re: 2Q: how to change window contents and GnomeUIINFO
PostPosted: Fri Aug 10, 2012 7:21 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

F1sher wrote:
1) How I can change window contents on the fly? I want to remove unwanted widgets and add new widgets.

This is simple: destroy unwanted widgets using gtk_widget_destroy() (if you destroy parent widget, all children will be destroyed too) and then simply create new controls.

F1sher wrote:
2) In my program I create menu using GNOMEUIInfo.

Don't use this, since gnomeui library is deprecated for quite a while now. Use GtkUIManager for this task. You can find migration assistance here.

Cheers,
Tadej


Top
 Profile  
 
 Post subject: Re: 2Q: how to change window contents and GnomeUIINFO
PostPosted: Sat Aug 11, 2012 8:10 am 
Offline
Familiar Face

Joined: Tue Nov 29, 2011 7:59 pm
Posts: 11
Ok, thank you for fast answer.

I add actions to group like it:

Code:
gtk_action_group_add_actions (group, entries. number_entries, (gpointer) data_to_cb);


I try to transfer pointer on vbox from main function to callback function, but when i try to add widget to vbox with
Code:
gtk_box_pack_start(GTK_BOX(vbox), widget_to_pack, TRUE, TRUE, 0);
it did't added, that is, no change occurs. I tried to send from the main function pointer to a label and change it, then to the callback function and it's going well. Is there any way in callback function to add widgets into the vbox?


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group