Display object param

hi,
may I ask for help?
I have c++ example project from Udemy.com.

When I draw line, I want to add event OnClick, and display MessageBox
with start and end point.

How to do it?
Thank you very much.

// Display 2d Curves
for (int i = Curves2d.Lower(); i <= Curves2d.Upper(); i++)
{
Handle(Geom2d_Curve) L = Curves2d.Value(i);
GetView()->DisplayCurve(L, Aspect_TOL_DASH, Aspect_WOL_THICK, Quantity_NOC_DARKSLATEBLUE, Standard_False);
}