GtkSheet Tutorial | ||
---|---|---|
<<< Previous | GtkSheet | Next >>> |
The first step is to create the sheet widget and to pack it into a scrolled window. If you pack the sheet into a normal window you will receive some warnings about adjustment signals.
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); ............................... window_box= gtk_vbox_new (FALSE,TRUE); scrolled_window=gtk_scrolled_window_new(NULL, NULL); gtk_container_add (GTK_CONTAINER (window), window_box); gtk_box_pack_start (GTK_BOX (window_box), scrolled_window, 1,1,1); sheet=gtk_sheet_new(3,11,"Edit table"); GTK_SHEET_SET_FLAGS(sheet, GTK_SHEET_AUTORESIZE); gtk_container_add(GTK_CONTAINER(scrolled_window), sheet); gtk_widget_show_all(window); |
You should set the GTK_SHEET_AUTORESIZE flag so the cell would resize as you type. GtkSheet can be created with a custom entry widget. You can use GtkEntry or a GtkEntry subclass (e.g. GtkSheetEntry, GtkSpinButton) or a box or table containing a GtkEntry subclass (e.g. GtkCombo)
gtk_sheet_new_with_custom_entry (gint nrows, gint ncols, GtkType *entry_type); |
if you want to construct a non-editable spreadsheet ( called "browser sheet") , just fow viewing purposes use:
gtk_sheet_construct_browser(GtkSheet *sheet,guint rows,guint columns, const gchar *title); |
The lines and columns(white coloured by default) are numbered from 0 to max row/col number. The gray row/col are numbered -1 . GtkSheet screenshot:
<<< Previous | Home | Next >>> |
GtkSheet | Up | Sheet Signals |