Edit fields in repeater with row selection and selected row hightlighting

repeater-widget

#1

Hi,
I’m trying to create what I think is fairly common table behaviour–I’m making slow progress but am struggling.

I am using repeater to create a data grid with some read-only fields and some editable fields. When clicking on a row it should become selected (background and foreground colours change to reflect selected state). When clicking on editable fields the row should become selected if not already and I should be able to edit the cell.

I’ve followed the article Selecting an item from a repeater to as a set up for row selection and highlighting of background rows. This works great as long as none of my controls are editable due to the hotspot mask over the whole row.

To add an editable text field I split the hotspot control into multiples around the editable fields, each with duplicate events to collect mouse events and trigger row selection. So I get row selection in non-editable fields and editing in editable fields.

The two problems I have now are:

  • There is no selected style for the textfield so when the row is selected I cannot set the text to white to show against the darker selected state background. I’ve tried the focused and selected are not in sync.

  • Clicking in the text field allows me to edit the text but doesn’t not trigger row selection. I’ve tried adding On Click or On Mouse down events on the text field but this intercepts the trigger to edit mode so now the row selects but I can’t edit the field. I tried firing the Mouse Down event of the hotspot from this but that didn’t correctly.

I’ve uploaded a simple example that shows where I’m at. Any thoughts would be greatly appreciated.

Editable selectable repeater text field.rp (63.1 KB)


#2

Hi @blair,

=> You could have a hidden white label above your textfield that you show OnFocus

=> With textfield I think the best is to use Onfocus or On TextChange.
Here OnFocus, select your backgroung

I don’t use RP9 so I did an example with RP8:
Repeater_selection_dark_background.rp (55.2 KB)

Hope it will be of some help,
Best,