Thanks for replying! I certainly would be glad if proved wrong, but I see three problems here, two are human interface issues, the other is a technical issue.
************************************************************ 1) In GtkTreeview with GtkListStore, show always the first item as default, when selection is SINGLE or BROWSE Sometimes it makes sense to have a default, sometimes it doesn't. If you are selecting fonts, it makes sense to show medium as default. If you are selecting hotels for vacations, it makes no sense to have a default. The first hotel for default? why? users will suspect that you are pushing that hotel on them! One of my lists contains crystallographic space groups. When showing all of them they are 230. The first ones are not common in Nature. The most found in metals, ceramics, minerals are, say the hexagonal and cubic ones, which are the last ones in the list. Which group should I show as default? The number 1, as GTK wants? it is a triclinic group, seldom used in crystallographic work... most important in metals are groups 194, 225, 229... Clearly the best choice is: show no default, the user chooses! In GTK_SELECTION_SINGLE there is always a default, for a GtkListStore, and this default is the first item on the list. This is wrong! If I think that a default should be set, I should be able to easily do it myself, not GTK for me! Interestingly enough, when GtkTreeStore is used, then no default is set... even for GTK_SELECTION_BROWSE! even when the tree nodes have no child, so they behave exactly as list nodes (so the SAME lists produced with TreeStore and ListStore behave differently...) only when the user clicks, something is selected... A simple workaround is to start with GTK_SELECTION_NONE, and then change to GTK_SELECTION_BROWSE, after the window is shown. This way no default is shown initialliy. ******************************* 2) Click to select, Ctr Click to unselect In computer interfaces, everytime we have two-state choices (up-down, 0-1, yes-no, true-false), the solution should be: click to change the state. So if you are in state 0, clicking takes you to state 1, clicking again takes you to state 0, and so on... This is the way toogle and check buttons work. When you want to maximize a window you click on the WM decorations, to restore the window you click again on the same WM decorations. There are many examples of this... Select/Unselect rows is clearly a two-state operation, from the point of view of users, so it should work in the usual way: click to select, click again to unselect, click again to select, exactly as in toogle and check buttons... Clicking to select rows and Ctrl Clicking to unselect them, makes as much sense as Clicking to toggle buttons, and Ctrl Clicking to untoggle them... this is exactly the opposite of HIG common-sense guidelines... ********************************************************* 3) In both GTK_SELECTION_SINGLE and GTK_SELECTION_BROWSE modes, with a GtkListStore, this code gets the correct selection, when clicking on a row, if you are NOT pressing Ctrl or Shift keys: GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; char *name; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, 0, &name, -1); printf ("Selected: %s\n", name); free (name); } else printf ("Selected: None\n"); However, if you are pressing Ctrl or Shift, when selecting a different item, this code returns the PREVIOUS item, not the current one. Please check this working example (as simple as possible, to show my point): http://www.gamgi.org/treeview.c If you click on Apples, the selection gets Apples. If you click on Bananas, the selection gets Bananas. But if you then do Ctrl click on Apples, the selection gets Bananas, not Apples! Carlos Kristian Rietveld wrote: > Could you more precisely describe what you think is wrong? I quickly > tested with GTK+ trunk and I do not see any problems. It is indeed the > case that one row is basically always selected (both with single and > browse mode) and the main difference between browse and single mode is > that in browse mode you cannot use ctrl+click to unselect a row. And > this is something that does work and is possible in single selection > mode. > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list