Subscribe Bookmark RSS Feed

set row change function of Table Box

volf

Staff

Joined:

Jun 23, 2011

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});
);
-->