Page 1 of 1

[RPG]Reset highlight current row

Posted: Wed Jul 25, 2018 6:29 pm
by MegumiSawada
Hi

Is there any way to reset Highlight row when button (above the table) is clicked?
IMG_1627.PNG
IMG_1627.PNG (41.8 KiB) Viewed 5655 times
I can reset highlight row by setting HighlightCurrentRow to OFF when button is clicked.
However, it will stop showing highlight row afterwards.
I would like to set table to be highlighted again when one of table row is clicked again.

It seems none of the following way acheives the expected result.
-Retreive the current row id and set ROW%N.Highlight to OFF
-Set table's CurrentRowID to null
-Set table's CurrentRowID to non-existing value
-Set table's HighlightCurrentRow to OFF and ON again

I appreciate your kind advice!

Best Regards,
Megumi Sawada

Re: [RPG]Reset highlight current row

Posted: Mon Jul 30, 2018 3:18 pm
by jasonzhou
The Row.HighLight property can implement this. The implementation steps are:

• Set HighlightCurrentRow to False

• Set Row.HighLight to True when current row is touched

• Set all Row.HighLight properties to False when reset highlight

Please see the following demo code:

Code: Select all

// Highlight touched row
Begsr ON_ROW_TOUCHED;
    // Clear previously highlighted row
    For Local.Index = 1 to 50;
        LRNG_Using('/Form.Fields.TABLE1.ROW' : Idx(Local.Index));
        LRNG_SetProperty('HighLight' : 'False');
    endfor;
    
    // Get Current row id
    RowId = LRNG_GetPropAsStr('/Form.Fields.TABLE1.CurrentRowID');

    // Highlight selected row
    HighLightedRow = '/Form.Fields.TABLE1.ROW%' + RowId + '.HighLight';
    LRNG_SetProperty(HighLightedRow: 'True');
Endsr;

// clear all highlights when click clear button
Begsr ON_CLEAR_HIGHLIGHT_BUTTON_CLICKED;
    // Clear all highlighted rows
    For Local.Index = 1 to 50;
        LRNG_Using('/Form.Fields.TABLE1.ROW' : Idx(Local.Index));
        LRNG_SetProperty('HighLight' : 'False');
    endfor;    
Endsr;