15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


ajusting position of I-beam cursor

WaiWai -- lamwai@iscs.nus.sg
Sunday, October 13, 1996

Environment: VC 4.0, Win95

i am trying to bring the Ibeam cursor to the position at where i click
my right mouse button. i am not sure why the following piece of code
cannot work, can enlighten me?  thanx :)

void CVEditorView::OnRButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default LRESULT
    result=SendMessage(EM_CHARFROMPOS,0,MAKELPARAM((WORD)point.x,
			(WORD)point.y));
    GetRichEditCtrl().SetSel((long)result,(long)result);	
    CRichEditView::OnRButtonDown(nFlags, point);
}


wai




Tim Oneil -- toneil@visigenic.com
Monday, October 14, 1996

[Mini-digest: 2 responses]

At 01:48 PM 10/13/96 +0800, you wrote:
>Environment: VC 4.0, Win95
>
>i am trying to bring the Ibeam cursor to the position at where i click
>my right mouse button. i am not sure why the following piece of code
>cannot work, can enlighten me?  thanx :)
>
>void CVEditorView::OnRButtonDown(UINT nFlags, CPoint point) 
>{
>// TODO: Add your message handler code here and/or call default LRESULT
>    result=SendMessage(EM_CHARFROMPOS,0,MAKELPARAM((WORD)point.x,
>			(WORD)point.y));
>    GetRichEditCtrl().SetSel((long)result,(long)result);	
                                     ^             ^

>    CRichEditView::OnRButtonDown(nFlags, point);
>}

Don't you need to filter the hiword and the loword from these?
Your setting the coordinates to the same long integer.
Just want to see if I'm right...
-Tim

-----From: Joseph Jones 

It is possible that CRichEditView::OnRButtonDown(nFlags, point); is
doing some default processing for you that is changing the state of the
cursor after you have changed it. Try either removing it placing it
before your code.

joe



Mike Blaszczak -- mikeblas@nwlink.com
Tuesday, October 15, 1996

At 13:48 10/13/96 +0800, WaiWai wrote:
>Environment: VC 4.0, Win95

>i am trying to bring the Ibeam cursor to the position at where i click
>my right mouse button. i am not sure why the following piece of code
>cannot work, can enlighten me?  thanx :)
>
>void CVEditorView::OnRButtonDown(UINT nFlags, CPoint point) 
>{
>// TODO: Add your message handler code here and/or call default LRESULT
>    result=SendMessage(EM_CHARFROMPOS,0,MAKELPARAM((WORD)point.x,
>			(WORD)point.y));
>    GetRichEditCtrl().SetSel((long)result,(long)result);	
>    CRichEditView::OnRButtonDown(nFlags, point);
>}

It seems like you shouldn't be calling the base class.  What happens if
you remove that call?

.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |