[Calc] trigger on edit with msgBox creates unwanted selection

Good evening
I’m learning the basics and triggers.
So a macro on a content change event on a sheet that searches for the row or line and the content of the first column to display it in a message.
it works fine except that when I click on another cell, which triggers the event, moving the mouse or the pad to the dialog box and clicking ok or cancel creates an unwanted selection.
how to avoid this behavior please?
oh to clarify,
the phenomenon of selection enlargement only occurs when the cursor is above the dialog box
the macro

REM  *****  BASIC  *****
Sub Macro1(oevt)
if  oevt.supportsService("com.sun.star.table.Cell") then
rem get access to the document
	oCC = Thiscomponent.CurrentController
	r = oevt.CellAddress.Row
	oCell = oevt.SpreadSheet.getCellByPosition(0,r)
	oCellVal = oevt.SpreadSheet.getCellByPosition(0,r).String
	MsgBox("row : " + r + ", " + "valeur A0 : " + oCellVal,1,"dialog box")
End if
End Sub

essaiBasic2_V1.ods (8.9 KB)

1 Like

Hello,
i have the same behaviour if i click into another cell after the modification of a cells content.
But if i complete the modification by using the ENTER-key, there is no problem.
I shortend your macro, deleted useless codelines:

Sub Macro1(oevt)
    if  oevt.supportsService("com.sun.star.table.Cell") then
	    r = oevt.CellAddress.Row
	    oCell = oevt.SpreadSheet.getCellByPosition(0,r)
	    oCellVal = oCell.String
	    MsgBox("row : " + r + ", " + "valeur A0 : " + oCellVal,1,"dialog box")
    End if
End Sub

1 Like

yes I knew that, but the thing is that users don’t hit enter or tab.
So how to avoid this selection in this case, or how to force to type enter ?