2009-11-24 84 views
0

我有一个要求,我需要在表格中显示4列的表格 带有标题。要选择哪个GTK + Widget来满足这个需求?

+-----------------+-----------------+-----------------+ 
|Header 1   |Header 2   |Header 3   | 
+-----------------+-----------------+-----------------+-+ 
|GtkLabel Info 1 | GtkLabel Info 1 | GTKImage Info 1 |S| 
|GtkLabel Info 2 | GtkLabel Info 2 | GTKImage Info 2 |C| 
|GtkLabel Info 3 | GtkLabel Info 3 | GTKImage Info 3 |R| 
|GtkLabel Info 4 | GtkLabel Info 4 | GTKImage Info 4 |O| 
|GtkLabel Info 5 | GtkLabel Info 5 | GTKImage Info 5 |L| 
|GtkLabel Info 6 | GtkLabel Info 6 | GTKImage Info 6 |L| 
+-----------------+-----------------+-----------------+-+ 

当用户点击任何行(右/左)我需要弹出一些菜单。所以每一行都需要有一些独特的id或类似的东西,这样我就会知道哪个联系人被选中了。另外我需要用某种不同的颜色突出显示选定的行。

SO在GTK中是否有任何支持此功能的窗口小部件?

我试着用表,但它没有给我适当的结果,因为我想要它。

谢谢, PP。

回答

3

GTK的TreeView

GTK的TreeModel(docs)允许存储自定义对象和GTK的CellRenderer-S(docs)帮助您使用自定义颜色和字体来显示项。

我不知道您使用哪种语言,但有RubyPython的优秀教程。 PyGtk FAQ会帮助你。

+0

感谢您的回复,我在C中使用GTK +,您能否提供一些相关示例。 – User7723337 2009-11-24 06:23:49

+0

试试这个http://scentric.net/tutorial/ – demas 2009-11-24 06:32:14

相关问题