English 中文(简体)
Gtk. Treeview 通过信号和代码取消选择行
原标题:Gtk.Treeview deselect row via signals and code

我使用PyGobbject, 但我认为这是一个可以适应所有 GTK 的问题, 所以如果有人知道如何使用 C 或任何东西 也可以在 Python 工作。

I have two treeview, Active and Inactive, I load data from a Sqlite database and I can swap and drag & drop items from one to other. This is just an aestetic thing, if I click on one item on one treeview I want that a previous selected item on the other be deselected.

看来没人非得做类似的事 因为我在网上没找到任何关于它的东西

最佳回答

风险是太基本(也许我误解了问题), 无法操作树眼选择, 您使用从 < code> GtkTreeEstection 返回的 < dcode > 对象。 您可以附加到此对象上的信号, 更改当前的选择, etc 。

问题回答

要关闭其他视图的选择, 您可以在其它视图中获取选择模式属性, 并将其设置为 < code> GTK_ SELECEtion_ noone 。 要在点击时打开它, 我的想法是, 您可以捕获一个 < code> grab- point 信号, 将选择模式设置为单一, 并在其它视图中将选择模式设置为零 :

 (connect view-1  grab-focus
       (lambda args
         (set-mode (gtk-tree-view-get-selection view-1) "GTK_SELECTION_SINGLE")
         (set-mode (gtk-tree-view-get-selection view-2) "GTK_SELECTION_NONE")))

(该代码使用的是“http://www.gnu.org/software/guile-gnome/” rel=“nofollow”>guile-gnome 包装器,但在任何语言中,这个概念都应该是相同的。 )这个方法的一个问题是,现在为了选择一个选择,你必须双击树形视图- 一次来抓住焦点, 一次来选择焦点 。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签