GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Jul 31, 2014 11:29 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: simple list in GTK
PostPosted: Wed Nov 28, 2007 4:08 am 
Offline
Familiar Face

Joined: Mon Aug 13, 2007 5:42 pm
Posts: 5
I need to create a simple list of items which are selectable by the user in GTK, but I am unable to do this. I need something with similar functionality to the JList from Java. There are two objects I have found in GTK which seem like they might suit my needs, the List object and the TreeView object. The List object is deprecated, so I have not looked at this much, though screen caps from GIS show this to be what I need. The treeview object is what is currently recommended, but with the wide variety of unneeded things, it is too cumbersome and confusing to use. Is there any way I can get something which is simple? Essentially all I need is to be able to add a string item to the list, remove an item from the list, find out which items are selected, and update a particular item in the list. What is the easiest way to do this?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 28, 2007 5:16 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Ah yes, the GtkTreeView can be a bit overwhelming at first. It may seem unnecessarily complex at first, but they did this with good reason. I remember my frustration with the limitations of such controls in Visual Basic and Visual C++ on Windows.

So, what you'll probably end up using is GtkTreeView with a GtkListStore as the model. This is explained in Chapter 8 of Andrew's Foundations of GTK+ Development, and there is a very thorough GTK+ Treeview Tutorial at http://scentric.net/tutorial/.

I created a quick example for you and posted in in the example code forum: http://www.gtkforums.com/about902.html

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 28, 2007 4:02 pm 
Offline
Familiar Face

Joined: Mon Aug 13, 2007 5:42 pm
Posts: 5
Thank you, the sample code was very helpful.


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 3 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group