def _selection_row_updated ( self, event ):
        """ Handles the user selecting items (rows, columns, cells) in the
            table.
        """
        gfi  = self.model.get_filtered_item
        rio  = self.model.raw_index_of
        tl   = self.grid._grid.GetSelectionBlockTopLeft()
        br   = iter( self.grid._grid.GetSelectionBlockBottomRight() )
        rows = len( self.model.get_filtered_items() )
        if self.auto_add:
            rows -= 1

        # Get the row items and indices in the selection:
        values = []
        for row0, col0 in tl:
            row1, col1 = br.next()
            for row in xrange( row0, row1 + 1 ):
                if row < rows:
                    values.append( ( rio( row ), gfi( row ) ) )

        if len( values ) > 0:
            # Sort by increasing row index:
            values.sort(key=itemgetter(0))
            index, row = values[0]
        else:
            index, row = -1, None

        # Save the new selection information:
        self.set( selected_row_index  = index,
                  trait_change_notify = False )
        self.setx( selected_row = row )

        # Update the toolbar status:
        self._update_toolbar( row is not None )

        # Invoke the user 'on_select' handler:
        self.ui.evaluate( self.factory.on_select, row )
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/table_editor.py/TableEditor._selection_row_updated/original