BookmarkSubscribe
Choose Language Hide Translation Bar
volf
Staff (Retired)

set row change function of Table Box

Hi,

One of customers hope to be calculated total sum in table box,
when user change a value like Excel.

But set row change function of Table Box is evaluated when a row is selected.
If the function is evaluated when a row is deselected, this issue could be solved.

Please review my sample code as below.

Regards,
Sung-soo.

<--
Names Default To Here( 1 );
New Window( "Mountains",
      tb = Table Box(
            scb = String Col Box( "Mountain", {"K2", "Delphi", "Kilimanjaro", "Grand Teton"} ),
            ncb = Number Col edit Box( "Elevation (meters)", {1, 1, 1, 1} ),
      )
);
tb << Set Selectable Rows();
tb << set row change function(
      //
      ncbVals = ncb<<get;
     
      if( n items(ncbVals) >= 5,
            tb << delete Row( 5 );
      );
      totVals = 0;
      for(i=1, i<= 4, i++,
            totVals = totVals + ncbVals;
      );
      tb<<Insert Row(5, {"Total", totVals});
);
-->

0 Kudos