Q: Getting cursor position 
Author Message
 Q: Getting cursor position

Hi,

I'm writing an SDI application with a RichEditView. I would like to know how
to do the following:

(1) Determine the position of the cursor in the View, or more precisely,
whether the cursor is at the beginning of the "line" i.e. at the leftmost
side of the screen.

Can anybody help?

Thanks in advance

John



Sun, 01 Sep 2002 03:00:00 GMT  
 Q: Getting cursor position


Fri, 19 Jun 1992 00:00:00 GMT  
 Q: Getting cursor position
By the way, I also need to know how to prevent text being selected within
the View.

Thanks again

John



Quote:
> Hi,

> I'm writing an SDI application with a RichEditView. I would like to know
how
> to do the following:

> (1) Determine the position of the cursor in the View, or more precisely,
> whether the cursor is at the beginning of the "line" i.e. at the leftmost
> side of the screen.

> Can anybody help?

> Thanks in advance

> John



Sun, 01 Sep 2002 03:00:00 GMT  
 Q: Getting cursor position


Fri, 19 Jun 1992 00:00:00 GMT  
 Q: Getting cursor position
On Wed, 15 Mar 2000 08:35:08 -0000, "John Paul Jones"

Quote:

>I'm writing an SDI application with a RichEditView. I would like to know how
>to do the following:

>(1) Determine the position of the cursor in the View, or more precisely,
>whether the cursor is at the beginning of the "line" i.e. at the leftmost
>side of the screen.

>John

Hi John,

First you want to use EM_SETEVENTMASK and set the ENM_MOUSEEVENTS
Flag.

SendMessage(
        this,              // handle to destination window
        EM_SETEVENTMASK,          // message to send
        0;          // not used; must be zero
         ENM_MOUSEEVENTS;          // event mask
);
I do this in the initilization routines.

To get the cursor use
OnNotify
and watch for  
EN_MSGFILTER

then look at the MSGFILTER structure's msg (WM_MOUSEMOVE is what you
are looking for), lParam ( HIWORD(lParam) for y and LOWORD(lParam) for
x).
You will want to figure what you think is far left. maybe x = 8, maybe
x=1.

Soooo.....

BOOL CApp::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
   MSGFILTER *mf = (MSGFILTER *)lParam;
   if(mf->msg == WM_MOUSEMOVE)
   {
        if( LOWORD(mf->lParam) < 12)
        {
           //Do My Beginning of line stuff
        }
   }

Quote:
}

//disclaimer
code never came near a compiler/de{*filter*}   =]

HTH

++j



Sun, 01 Sep 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Getting cursor position and text from OE compose window (Internet Explorer_Server)

2. Get cursor position

3. rich text box cursor position?

4. cursor positioning

5. Clear screen and cursor-position

6. Mouse cursor position

7. how to set the position of the text-cursor ?!°

8. cursor positioning

9. how could I set the position of the cursor

10. Mouse Cursor Position Problem

11. Help needed: Positioning the screen cursor

12. LOCATING THE CURSOR POSITION IN A CONSOLE APPLICATION

 

 
Powered by phpBB® Forum Software