TextBlock click event or Detect Editing is Starting

I want change the table cell color to shows the cell is selected. but TextBlock click event is prevented,
how can i know the TextBlock start editing.
my question is close to
TextBlock click event this, but different.

By default a click on an editable TextBlock does not start editing – the Part has to be selected first. That behavior is controlled by the TextEditingTool.starting property.

It seems to me that whether a cell is selected is somewhat independent of whether some text is editable. Is that what you want? What do you mean by “but TextBlock click event is prevented”? One cannot prevent the user from clicking on anything, but one can choose to ignore click events.

If you want to do something when the TextEditingTool has started running, you can override the TextEditingTool.doActivate method. Call the super method and check whether Tool.isActive is true.

OK let me try to use this to implement the feature.

But how can I get the TextBlock instance,

dgm.toolManager.textEditingTool.doActivate = function() {
	console.log( this.textBlock ); // is null
	return go.TextEditingTool.prototype.doActivate.call(this);

the TextBlock is null.

Edit: sorry first time is null , then activated, it is not null.

Yes, the standard doActivate behavior is to set the TextEditingTool.textBlock property to refer to the TextBlock being edited.

Walter, thank you.