code: def OnCellSelected(self, event):
          
  
          key = row, col, tab = event.Row, event.Col, self.grid.current_table
  
          # Is the cell merged then go to merging cell
          cell_attributes = self.grid.code_array.cell_attributes
          merging_cell = cell_attributes.get_merging_cell(key)
          if merging_cell is not None and merging_cell != key:
              post_command_event(self.grid, self.grid.GotoCellMsg,
                                 key=merging_cell)
  
              # Check if the merging cell is a button cell
              if cell_attributes[merging_cell]["button_cell"]:
                  # Button cells shall be executed on click
                  self.grid.EnableCellEditControl()
  
              return
  
          # If in selection mode do nothing
          # This prevents the current cell from changing
          if not self.grid.IsEditable():
              return
  
          # Redraw cursor
          self.grid.ForceRefresh()
  
          # Disable entry line if cell is locked
          self.grid.lock_entry_line(
              self.grid.code_array.cell_attributes[key]["locked"])
  
          # Update entry line
          self.grid.update_entry_line(key)
  
          # Update attribute toolbar
          self.grid.update_attribute_toolbar(key)
  
          self.grid._last_selected_cell = key
  
          event.Skip()
docs: Cell selection event handler