Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Inability to edit a cell on the first or new table row

Hi all

I have setup an SRP edittable as per below. There is 1 column that should be edittable (SKN), however for a new table (i.e. no rows) I cannot select it. I can select this row if I make all other columns protected, however I don't want to do this (all the other columns are currently selectable).

Tested on SRPControls 3.1.1 on Win 7 (32-bit). Please let me know if you need anymore details.

* product grid positions equ ctrl_products$ to window:'.GRD_PRODUCTS' equ skn_image_pixels$ to 50 equ no_of_cols$ to 9 equ skn_id_pos$ to 1 equ skn_sequence_no_pos$ to 2 equ skn_image_pos$ to 3 equ skn_pos$ to 4 equ skn_description_pos$ to 5 equ skn_department_pos$ to 6 equ skn_colour_size_pos$ to 7 equ skn_price_pos$ to 8 equ skn_avail_pos$ to 9 setup_edittable: set_property(ctrl_products$, 'OLE.Dimension', no_of_cols$:@fm:1) set_property(ctrl_products$, 'OLE.List', '') set_property(ctrl_products$, 'OLE.CellImage[':skn_image_pos$:'; All;]', '') set_property(ctrl_products$, 'OLE.CellImageLayout[All; All]', 'TH') * hide row selection buttons set_property(ctrl_products$, 'OLE.HeaderColumn[All]', 0:@fm:false$) set_property(ctrl_products$, 'OLE.AllowDeletions', false$) set_property(ctrl_products$, 'OLE.AllowInserts', false$) * tell grid that each single row is a record set_property(ctrl_products$, 'OLE.RowsToRecords', 1) * set row height set_property(ctrl_products$, 'OLE.DataRow[All]', skn_image_pixels$) ;* image height * set validation/conversion conv_settings = '' conv_settings<1> = '[ITV_CONV_SKN]' ;* validation conv_settings<2> = '[ITV_CONV_SKN]' ;* conversion set_property(ctrl_products$, 'OLE.CellConv[':skn_pos$:'; All]', conv_settings) * set column widths set_property(ctrl_products$, 'OLE.DataColumn[':skn_id_pos$:']', 0) ;* script id (hidden) set_property(ctrl_products$, 'OLE.DataColumn[':skn_sequence_no_pos$:']', 35) set_property(ctrl_products$, 'OLE.DataColumn[':skn_image_pos$:']', skn_image_pixels$) ;* image width set_property(ctrl_products$, 'OLE.DataColumn[':skn_pos$:']', 70) set_property(ctrl_products$, 'OLE.DataColumn[':skn_description_pos$:']', 150:@fm:@fm:@fm:True$) set_property(ctrl_products$, 'OLE.DataColumn[':skn_department_pos$:']', 100) set_property(ctrl_products$, 'OLE.DataColumn[':skn_colour_size_pos$:']', 30) set_property(ctrl_products$, 'OLE.DataColumn[':skn_price_pos$:']', 60) set_property(ctrl_products$, 'OLE.DataColumn[':skn_avail_pos$:']', 50) * set column titles + alignment column_titles = '' column_titles<1,skn_sequence_no_pos$> = 'Seq.' column_titles<1,skn_image_pos$> = 'Image' column_titles<1,skn_pos$> = 'SKN' column_titles<1,skn_description_pos$> = 'Description' column_titles<1,skn_department_pos$> = 'Department' column_titles<1,skn_colour_size_pos$> = 'C/S' column_titles<1,skn_price_pos$> = 'Price' column_titles<1,skn_avail_pos$> = 'Avail' set_property(ctrl_products$, 'OLE.TitleList', column_titles) set_property(ctrl_products$, 'OLE.HeaderAlignment[All; All]', 'C':@fm:'C') * set non-text cell types/format set_property(ctrl_products$, 'OLE.CellType[':skn_colour_size_pos$:'; All]', 'CHB') ;* checkbox set_property(ctrl_products$, 'OLE.CellImageLayout[':skn_image_pos$:'; All]', 'S') * disable editting for all except the SKN cell set_property(ctrl_products$, 'OLE.CellProtection[':skn_id_pos$:'; All]', 'Full') set_property(ctrl_products$, 'OLE.CellProtection[':skn_sequence_no_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_image_pos$:'; All]', 'Selectable') ;* so cell can be selected set_property(ctrl_products$, 'OLE.CellProtection[':skn_pos$:'; All]', 'Edit') set_property(ctrl_products$, 'OLE.CellEditMode[':skn_pos$:'; All]', 'Edit') ;* auto-enter editmode set_property(ctrl_products$, 'OLE.CellProtection[':skn_description_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellMultilined[':skn_description_pos$:'; All]', true$) ;* word-wrap set_property(ctrl_products$, 'OLE.CellProtection[':skn_department_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellMultilined[':skn_department_pos$:'; All]', true$) ;* word-wrap set_property(ctrl_products$, 'OLE.CellProtection[':skn_colour_size_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_price_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_avail_pos$:'; All]', 'Selectable') * set column cell alignments set_property(ctrl_products$, 'OLE.CellAlignment[':skn_sequence_no_pos$:'; All]', 'C':@fm:'C') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_image_pos$:'; All]', 'C':@fm:'C') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_pos$:'; All]', 'C':@fm:'C') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_description_pos$:'; All]', 'C':@fm:'L') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_department_pos$:'; All]', 'C':@fm:'C') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_colour_size_pos$:'; All]', 'C':@fm:'C') set_property(ctrl_products$, 'OLE.CellCheckEnabled[':skn_colour_size_pos$:'; All]', false$) set_property(ctrl_products$, 'OLE.CellAlignment[':skn_price_pos$:'; All]', 'C':@fm:'R') set_property(ctrl_products$, 'OLE.CellAlignment[':skn_avail_pos$:'; All]', 'C':@fm:'R') * always show the selected cell set_property(ctrl_products$, 'OLE.ResetSelPos', false$) selection_style = get_Property(ctrl_products$, 'OLE.SelectionStyle') selection_style<8> = true$ set_property(ctrl_products$, 'OLE.SelectionStyle', selection_style) * ensure no selection + setup selection colour set_property(ctrl_products$, 'OLE.SelPos', 'None') ;* avoid any visual selection initially cell_selection_colours = get_Property(ctrl_products$, 'OLE.CellSelColors[All; All]') cell_selection_colours<2> = 'S L=85' ;* background set_property(ctrl_products$, 'OLE.CellSelColors[All; All]', cell_selection_colours) return
User: James Birnie

Comments

  • If you make all cells selectable and one cell fully protected, which is what you've done in this code, then nothing is editable. If you want the user to be able to edit the first cell, then the protection needs to be set to None.

    Also, as an aside, it's preferable to hide a column over setting it's width to zero. This way you don't have to bother protecting it or working around the possibility of the user somehow navigating to it. So, instead of this:
    set_property(ctrl_products$, 'OLE.DataColumn[':skn_id_pos$:']', 0) ;* script id (hidden) set_property(ctrl_products$, 'OLE.CellProtection[':skn_id_pos$:'; All]', 'Full') You can just do this: set_property(ctrl_products$, 'OLE.DataColumn[':skn_id_pos$:']', @fm:0)
  • Hi Kevin

    Thanks for the speedy reply. I made the first column not visible as you suggested + removed the now redundant setting of the protection level for it. I also changed the cellprotection for the skn_pos$ to 'None' rather than 'Edit' as per below, however I still cannot select/edit any data into this 3rd column, the selection remains on the first visible column only. Only when the cells contain other data (via an optional import process) can I edit it directly.

    The only way I could edit it when empty is to make all the other columns 'Full' protection instead of 'Selectable'. Then I am allowed to select/edit this 3rd column. Is this expected behaviour? * disable editting for all except the SKN cell set_property(ctrl_products$, 'OLE.CellProtection[':skn_sequence_no_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_image_pos$:'; All]', 'Selectable') ;* so cell can be selected set_property(ctrl_products$, 'OLE.CellProtection[':skn_pos$:'; All]', 'None') set_property(ctrl_products$, 'OLE.CellEditMode[':skn_pos$:'; All]', 'Edit') ;* auto-enter editmode set_property(ctrl_products$, 'OLE.CellProtection[':skn_description_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellMultilined[':skn_description_pos$:'; All]', true$) ;* word-wrap set_property(ctrl_products$, 'OLE.CellProtection[':skn_department_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellMultilined[':skn_department_pos$:'; All]', true$) ;* word-wrap set_property(ctrl_products$, 'OLE.CellProtection[':skn_colour_size_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_price_pos$:'; All]', 'Selectable') set_property(ctrl_products$, 'OLE.CellProtection[':skn_avail_pos$:'; All]', 'Selectable') User: James Birnie
  • Ah, I see. You want to set the QuickTabOut property to false. By default it's on to emulate OI EditTable behavior, which is to allow the user to tab out of the control immediately if the SelPos is on the last row and the last row is empty.
  • That't it!!! set_property(ctrl_products$, 'OLE.QuickTabOut', false$) did the trick, thanks!

    User: James Birnie
  • Hi Kevin

    Me again sorry - it's *almost* perfect ;-)

    If I have all the cells protected, except the 3rd column (edit, which also has OLE.CellEditMode) -> user enters a value, presses down arrow (creates new row, and the new row, column 3 is again selected + ready for data entry).

    Using the above mentioned code (i.e. other selectable columns + QuickTabOut property), pressing the down arrow following data entry on row 1 still creates the new row, however the 3rd column is no longer selected/edittable, meaning the user has to select it manually with their mouse in order to continue data entry. Is there any way to get around this?

    Please let me know if you need anymore info,

    User: James Birnie
  • This looks like a bug. It appears that the selection is being moved to the first column, which is hidden, on each new row. I'll take a look at the code as soon as I can.
  • Cheers Kevin!

    User: James Birnie
  • This was certainly a bug and will be fixed in the next release.
Sign In or Register to comment.