Re: Grid in glade
Tristan Van Berkom <[email protected]>
| Newsgroups | gmane.comp.gnome.glade.user |
|---|---|
| Message-ID | <CAGUy9W+kJFBY9=7zgWMDvbHPMCXURNKns_Rze++jN_Ey4-azLA@mail.gmail.com> |
On Fri, Oct 14, 2011 at 11:30 AM, Arun p das <[email protected]> wrote: > hi > > Is there any widget which act as grid view or with similar functionality. I > want to list a set of names and associated values. > There is a new widget in GTK+3 called GtkGrid, but it's a general purpose layouting widget, I presume what you want is a GtkTreeView. However treeviews can be annoying to use and are only really necessary when the dynamic data set you want to display is potentially large. The alternative to using treeviews of course would be to do something like packing a widget for each row of data (name/value pair) into a vertical box and just display that in a scrolled window. Using treeviews is a bit of work to set up but can also be pretty powerful for displaying lists and trees of data... to create a treeview in Glade you need to a.) Create the GtkTreeView, make sure to assign it a GtkListStore for the "model" property b.) Start the editor by right-clicking the treeview and selecting "Edit" c.) On the right hand side of the editor, you edit the GtkListStore and add the column types (gchararray/gint for your name/value pair) d.) Add data below, add some names and values e.) Choose the "Hierarchy" tab f.) Add treeview columns g.) Right click on the added columns (still in the treeview editor) and use that menu to add a child GtkTextRenderer to the column h.) Now chose the 'text' property of the GtkTextRenderer and assign a relationship to the column id from your model (Glade lets you do this using a combo-box showing your previously defined column names from step c.) ). Of course, generally the actual data in a GtkTreeModel is usually dynamic and setup at run time, you can basically pass any model as long as the columns defined in the associated GtkTreeModel are defined with compatible types for the properties which are attributed them. Cheers, -Tristan _______________________________________________ Glade-users maillist - [email protected] http://lists.ximian.com/mailman/listinfo/glade-users