Hello group,

I am not too advanced on MFC and it is about 3:00 in the morning, so
sorry if the question turns out to be a silly one.
My aim is to construct something like Excel editor window on a Dialog
Detailed: I have a custom grid control and an edit box placed on a
All input in the grid is reflected in the editbox. When the input is
larger than the edit box widths its height increases and the input goes

to the next line.

The problem which I am facing now is the following.
When a cell is clicked where the text is quite long - the edit box is
enhanced (in order to show all the text) and part of it goes over the
grid. I am trying to implement the part where the mouse when clicking
on the lower (added programmatically) part of the edit sets the cursor
to corresponding part of the text in edit.

I catch the WM_LBUTTONDOWN message in the PreTranslateMessage, get the
current click coordinate, transform it to Screen coordinates (using
ClientToScreen of the grid as the current focus is on the grid), then
check if the click was made in the enhanced editbox. If yes I am
setting the focus to the edit box and sending WM_LBUTTONDOWN message to

the editbox (previously changing the coordinates to the client
coordinates of the edit)

The problem that seems very strange to me is that when the focus is set

to the editbox and I am clicking on the enhanced part of the edit the
coordinates that I get on that message are calculated basing on the
grid "calculation system", i.e. if I click in the initial part of the
edit I get the correct coordinates, and if I click in the added part of

the grid I get exactly the same number as I am getting when clicking on

the same point but when focus is on the grid.

I am sure from my different observations that in that part of the edit
the coordinate is being returned relative to the start of the grid. I
dont' understand if this is correct behavior! After I change the size
of the edit I call its UpdateWindow. What else can I do to make it

I am really stuck here, I just spent about 2 hours tracking numbers and

I would really appreciate any hints from you.