getLastKeyModifier Extended....

I notices getLastKeyModifier only works when a button is pressed. I was tying to use it when a record was clicked in listview. Would it be possible to get that as well?

(I want to know if the Control key was pressed when a record was selected)

Paul

that won’t be very easy to do for use.
Because the recordSelect action (i think you talk about that one yes?)
can be triggered from an source (for example what should it return if you use ALT-KEY UP/DOWN?)

Mmm, good question… :lol:

Basically, what I’m trying to create is something seem in other applications…

You have two lists with values (for example on the left side all the emailadresses in your addressbook and on the right side the addressees for 1 email). By selecting one or more values from the list on the left, then clicking a button to move them, you add the selected values from the list on the left to the list on the right.

I got so far creating this as to be able to have a selectedList (array of receordindexes that are selected) and highlighting the “selected” records. Now I only need to be able to distinquish between whether or not a selection of a record means “clear selected list and add currently selected record index” or “add currently selected record index to existing selectedList”.

Most commonly this is done by holding the control key on select or not…

So, that is where my question came from. Maybe you know of other options? I know this type of function in other developtools is just a standard element. Maybe you could add this as an element?

Paul

Request added to planning to make getLastKeyModifier working in this scenario.

tnx guys!

Jan,

Could you indicate if this new bit of extended functionallity might make it into one of the next beta’s?

Also, in the future, can we see options in Servoy to specify specific keycombinations and attach methods to them?

Paul

Hello,

is there any news on that? We’d also like to use control and shift key in table views…

Thanks
Patrick

When creating a new topic and typing the Subject, my browser hinted the subject of this post, which triggered me to look at it, only to be pleasantly surprized it was a post of my own, with exactly the same feature request I was just about to enter :D

Any word on this feature? I’m in the process of building another app, where I need to accomplish the same functionality as described before.

Scenario:
Got a TableView and want to trigger different actions if a record gets selected (by whatever means: selected by a mouseclick, selected by using the arrow up/down keys) in combination with pressing the Control or Shift key:
Shift+mouseselect: Select all records between previous selected record and the current selected record, deselect all other
Shift+arrow up/down: create selection of sequential records, all others are deselected
Control + mouseselect: Add selected record PK to Array, on which a BGRowcolor Calculation is based

Offcourse, the logic is supposed to work vise versa, meaning: if a records is selected that was allready in the selection, it get’s thrown out, but that is codeable.

What should be altered (I think) to support this functionality, is the following:

  • set the LastKeyModifier when an OnRecordSelection event occurs

While testing the current abilities of Servoy (2.2.x), I notices that Alt-Arrow up/down (which triggers the onNext/PreviousRecordCMD) does not work with modifier keys: If I press Shift-Alt-Arrow Up, nothing happens. Is that a bug?

Also, I noticed that pressing Arrow up/down when holding down the Control key will not result in selection of the next record. The same record stays selected.

To my knowledge, the described funcitonality is not possible right now in Servoy. Can this functionality be created in a future Servoy version (3.0 :D ), or is it technically not possible?

If possible, is this allready registered on the feature list, or should I create one in the suport system?

Paul

currently we don’t have a notion anywhere is servoy for multi selection.

What does controller.getSelectedIndex() give back?

What does onRecordSelection even do if you do for example CTRL-A (select all)?

Johan,

The multi select part of this functionality is codeable.

With the onRecordSelection event, you can store the PK or RecordIndex in a global array.

The BGRowcolor calculation can check if the PK of RecordIndex is registered in the Array.

The issue here is to only take action if a specific modifier key was pressed when the record was selected. Currently, the getLastKeyModifier doesn’t get set with the actual modifier when a Record is selected through Arrow Up/Down. Only when you select a Record by a mouseclick and you got an onAction event attached to all the fields of the Table view, the modifier key is registered.

So, to get this functionality working, whenever an onRecordSelection event is triggers, the LastKeyModifier needs to be updated.

Paul

Maybe to clarify it a bit more:

The goal here is to fake multiple selection, just by letting it appear in the GUI that multiple records are selected, by giving multiple lines another BackGroundcolor.

It’s up to the developer to manage the array with RecordIndexes/PK’s and perform whatever action he/she wants.

Paul

Additional note:

In the online documentation, the OnRecordSelection event is described as being invoked in TableViews only when the user selects a record by mouseclick.

This is incorrect, I think, or I’m misinterpreting the docs. The onRecordSelection is also fired when moving to the next record by (Alt) Arrow Up/Down

Paul

that is because onRecordSelection call is not done/triggered by a event like keyboard or mouse. Because it is triggered by a result of such an event. The selection model changes. Because onRecordSelection doesn’t have to be triggered by a user action. It can also be through scripting itself.

So currently we don’t have that information and it is not that easy to get either. For example when we should record everything and use the last modifier keys we encounter in the onRecordSelection. Then it is possible that when it really happens it was just a script and it shouldn’t happen. (that record of the keys was left behind from the last time that didn’t trigger an selection change)

thats incorrect yes. It is fired for every record selection change of the visible form.

So, not really possible, you say?

Isn’t it possible to “listen” to Arrow Up/Down events when a TableView/Portal/ListView has focus and record the Modifier Keys when the Arrow Up/Down keys get pressed, to go to the next/previous record?

And what about onNext/PreviousRecord?

The same could be achieved by using onNext/PreviousRecord, if these events would be allowed to have modifier keys.

Currently, pressing a modifier key together with ALT and Arrow Up/Down will result in nothing. The onNext/PreviousRecord methods are not fired.

The onNext/PreviousRecord option is less counter intuitive to me. User (according to me) are used to browse records just using the Arrow Up/Down keys.

Paul

no as i said. they are decoupled. Maybe for the 2 special commands we could do it. But in combination with mouse clicks and controller.setSelectedIndex() it will all be very hard to do.

only arrow down couldn’t be used always because it is consumed by other stuff. I tried to do that and for tableviews and so on it works now and then but not always.
Maybe i can improve that in the further but as a said only arrow is used for many other things.

Capturing Mouseclicks with Modifier keys can allready be dealt with by the developer, if you’re using a TableView where all fields are not editable and you attach onAction methods.

I do realize that there’s a multitude of possible key combination for which someone would like to have methods fired. It’s difficult territory to make something generic, I think.

Paul

onAction is a DIRECT result of a click. The click directly triggerers the action.

But with selection this is just not true. onSelectedRecord is triggered via via an action Where ever that action is comming from and what ever it is.

Yes, point taken :)