Re: multiple GTKentry inside a GTKnotebook
- From: Rudra Banerjee <bnrj rudra yahoo com>
- To: Olivier Sessink <oliviersessink gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: multiple GTKentry inside a GTKnotebook
- Date: Thu, 21 Jun 2012 00:36:54 +0530
Olivier,
Thanks for your interest.
Pasted just below is the complete code.
What I want to do with that is, as a raw commented snip by line number
106-116 that according to my selection of Book/Article in combobox, some
entry will be hidden.
But, for that, I need to get the data from the combo box, which I have
tried in line number 53-54.
Please help.
NB. Olivier, I got your reply in CC as well as a group post. So, I am
replying you also(reply to all). Please don't get offended if it was not
your intention.
/*******THE CODE********/
#include <gtk/gtk.h>
#include <stdio.h>
#include <string.h>
#include <gdk/gdk.h>
GtkWidget *window;
GtkWidget *vbox, *hbox, *combo;
GtkWidget *vbox1, *hbox1, *combo1;
GtkWidget *entry1;
GtkWidget *entryAuth;
GtkWidget *entryEditor;
GtkWidget *entryTitle;
GtkWidget *window;
int main(int argc,
char *argv[]) {
GtkWidget *window;
GtkWidget *button;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *notebook;
GtkWidget *label;
GtkWidget *checkbutton;
GtkWidget *widget;
int i;
char bufferf[32];
char bufferl[32];
// char bibtype;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "BibMk");
gtk_container_set_border_width(GTK_CONTAINER(window), 20);
g_signal_connect(window, "delete-event",
G_CALLBACK(gtk_main_quit), NULL);
// gtk_window_set_default_size(GTK_WINDOW(window), 200, 150);
vbox = gtk_vbox_new(FALSE, 0);
hbox = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), hbox);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
frame = gtk_frame_new("Properties");
combo = gtk_combo_box_text_new();
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Book");
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Article");
gtk_box_pack_start(GTK_BOX(vbox), combo, TRUE, TRUE, 0);
gtk_widget_show(combo);
gchar *bibtype = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
printf("%s", gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo)));
entry1 = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry1), "bibKey");
gtk_box_pack_start(GTK_BOX(hbox), entry1, TRUE, TRUE, 0);
gtk_widget_show(entry1);
/*
* CREATE THE NOTEBOOK PAN
*/
table = gtk_table_new(3, 6, FALSE);
/* Create a new notebook, place the position of the tabs */
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0, 6, 0, 1);
gtk_widget_show(notebook);
/*
* CREATE BASIC NOTEBOOK
*/
/*
* Authors Tab
*/
frame = gtk_frame_new("Authors");
gtk_widget_set_usize(frame, 400, 175);
vbox1 = gtk_vbox_new(FALSE, 0);
hbox1 = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), vbox1);
entryAuth = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entryAuth), "Author");
gtk_container_add (GTK_CONTAINER (vbox1), entryAuth);
gtk_widget_show(entryAuth);
entryEditor = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entryEditor), "Editor");
gtk_container_add (GTK_CONTAINER (vbox1), entryEditor);
gtk_widget_show(entryEditor);
entryTitle = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entryTitle), "Title");
gtk_container_add (GTK_CONTAINER (vbox1), entryTitle);
gtk_widget_show(entryTitle);
label = gtk_label_new("Authors/Title");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, label);
/* switch (bibtype) {
case book:
gtk_container_add(GTK_CONTAINER(vbox1), entryAuth);
gtk_container_add(GTK_CONTAINER(vbox1), entryEditor);
gtk_entry_set_text(GTK_ENTRY(entryTitle), "Title");
break;
case article:
gtk_container_add(GTK_CONTAINER(vbox1), entryAuth);
gtk_entry_set_text(GTK_ENTRY(entryTitle), "Title");
}
*/
gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
gtk_widget_show(table);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
/*******CODE END**********/
On Wed, 2012-06-20 at 13:20 +0200, Olivier Sessink wrote:
can you post a larger bit of the code? it is difficult to see what's going on.
b.t.w. gtk_combo_box_new_text() is deprecated, use gtk_combo_box_text_new()
Olivier
2012/6/20 Rudra Banerjee <bnrj rudra yahoo com>:
Thanks for your reply jjacky. This is a mistake; but does not changeing
the result.
On Tue, 2012-06-19 at 22:13 +0200, jjacky wrote:
On 06/19/12 21:43, Rudra Banerjee wrote:
Yeti, Thanks for your help. That is working now.
it should probably be GTK_COMBO_BOX(combo), not GTK_COMBO_BOX(widget)
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]