Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi selection: return ValueChanged if
notify and
immediate set
add comment about single/multi provide changelog improve changelog
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seem to show what i always said, checks and selections are quite different :)
IMO though a different approach should be provided, i mean now multi-selection in ncurses send a different YEvent, so QT and GTK work differently. I think YTable should have a list of items that can be retrieved by using getSelectedItems(...) and when a selection is performed
this list should be provided with a setSelectedItems(...) maybe in such a case the event should be Selected and not Activated, but that could have regressions in the current usage.
WDYT?
cheers,
Angelo
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, there a thing i can't get. From header file (immdiate mode explanation)
Deliver even more events than with notify() set.
With "notify" alone, a table widget sends an ActivatedEvent when the
user double-clicks an item or presses the "space" key on it. It does
not send an event when the user just sends another item.
With "immediate", it also sends a SelectionChangedEvent when the user
selects another item. "immediate" implicitly includes "notify".
So it seems that immediate mode includes notify, and i wonder why then if ( notify() && immediateMode() ), moreover i often use in my tests notify only, and without an || notify only does nothing.
Angelo
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, checks and selections are different. To make this clear I have added the comment "Some remarks about single/multi selection" to NCTable.cc.
getSelectedItems() is not a member of YTable but implemented in YSelectionWidget, see YSelectionWidget.
YSelectionWidget.h
virtual YItemCollection selectedItems();
About the events:
An Activated Event in general means an action should be done, the double click or Return/Space indicate this.
SelectionChanged e.g. in a list means that "only" the line has changed. The exact meaning can differ, e.g. it differs for the Table widget depending on single/multi selection mode set. Not in multiselection mode on Return/Space an Activated event is returned, in multiselection mode it means this line will be checked/unchecked (toogled). See also comment in NCTable.cc about the selectItem().
I have added the ValueChanged event to NCTable to indicate that the list of selected items has changed. Of course, this should be added to YQTable as well.
About the options:
notify and
immediate determine when to send the event. Yes, immediate somehow include notify but this is like this for all widgets (see also NCSelectionBox).To have a better understanding of how to use the options/the events I have added 2 additional examples to yast-ycp-ui-bings (Table8-mutliSel.ycp and MutiSelectionBox5.ycp).
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, i have a lot of things to check after your comment :)
BTW your change, allows me to add checkable columns easily now. Can you give a look at my fork to see if the implementation i did now is more suitable? Thanks
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can take a look at the new examples Table8-mutliSel.ycp and MutiSelectionBox5.ycp (and also the other examples for the table widget ) on git@github.com:yast/yast-ycp-ui-bindings.git. I think the examples are well suited for understanding how the events/options are used in practice.
To run the examples, call "/usr/lib/YaST2/bin/y2base ./Example.ycp ncurses (or qt)".
To have the changes in NCTable from this commit available you have to compile the yast-ycp-ui-bindings. Table8-multiSel.ycp will then show the list of selected items on every change in selection (for ncurses; not yet for qt).
0b69bb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.