1. Line and Col Positioning

can anyone tell me why these 2 lines get the line and column index
correctlly sometmes with the richedit control i am using, and why it
doesn't get them correctlly, fo example if i start of at line 1, col 1
and start tapping the down arrow it increment correctly line 2, line 3
etc but when i turn around and start hitting the up arrow it takes
about 2 hits and then starts incrementing down, i cannot work out
whether this is due to the way the richedit handles {13,10} -
"\n","\r" , if so does anyone know the flags i should be initialising
it with :- code below


Line = sendMessage(code,EM_LINEFROMCHAR,-1,0)
Col = w32lo_word(sendMessage(code,EM_GETSEL,0,0)) -
sendMessage(code,EM_LINEINDEX,-1,0)



thanks
Joe

new topic     » topic index » view message » categorize

2. Re: Line and Col Positioning

spent memory wrote:
> 
> can anyone tell me why these 2 lines get the line and column index
> correctlly sometmes with the richedit control i am using, and why it
> doesn't get them correctlly, fo example if i start of at line 1, col 1
> and start tapping the down arrow it increment correctly line 2, line 3
> etc but when i turn around and start hitting the up arrow it takes
> about 2 hits and then starts incrementing down, i cannot work out
> whether this is due to the way the richedit handles {13,10} -
> "\n","\r" , if so does anyone know the flags i should be initialising
> it with :- code below
> 
> 
> Line = sendMessage(code,EM_LINEFROMCHAR,-1,0)
> Col = w32lo_word(sendMessage(code,EM_GETSEL,0,0)) -
> sendMessage(code,EM_LINEINDEX,-1,0)
> 

Are you issuing these messages on KeyDown or KeyUp? I would recommend
KeyUp as that happens after the RichEdit has moved the caret.

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

3. Re: Line and Col Positioning

that makes alot of sense i was infact using multiple handlers ill show you :

setHandler(code,{w32HActivate,w32HChange,w32HGotFocus,w32HLostFocus,w32HKeyDown,w32HKeyPress,w32HClick},routine_id("statbarupdate"))




On Thu, 14 Oct 2004 06:23:54 +0000, Chris Bensler <bensler at nt.net> wrote:
> 
> 
> Derek Parnell wrote:
> >
> >
> > posted by: Derek Parnell <ddparnell at bigpond.com>
> >
> > spent memory wrote:
> > >
> > > can anyone tell me why these 2 lines get the line and column index
> > > correctlly sometmes with the richedit control i am using, and why it
> > > doesn't get them correctlly, fo example if i start of at line 1, col 1
> > > and start tapping the down arrow it increment correctly line 2, line 3
> > > etc but when i turn around and start hitting the up arrow it takes
> > > about 2 hits and then starts incrementing down, i cannot work out
> > > whether this is due to the way the richedit handles {13,10} -
> > > "\n","\r" , if so does anyone know the flags i should be initialising
> > > it with :- code below
> > >
> > >
> > > Line = sendMessage(code,EM_LINEFROMCHAR,-1,0)
> > > Col = w32lo_word(sendMessage(code,EM_GETSEL,0,0)) -
> > > sendMessage(code,EM_LINEINDEX,-1,0)
> > >
> >
> > Are you issuing these messages on KeyDown or KeyUp? I would recommend
> > KeyUp as that happens after the RichEdit has moved the caret.
> >
> > --
> > Derek Parnell
> > Melbourne, Australia
> 
> Derek is right.
> I was going to mention, that it sounds like buffered input. Trapping
> KeyDown will cause a new instance of the keypress to be stored in the
> input buffer everytime the KeyDown event is polled (as long as you are
> holding the key). Trapping KeyUp will store one keypress in the buffer
> for each time the key is released.
> 
> 
> Chris Bensler
> Code is Alchemy
> 
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Line and Col Positioning

nevermind joy joy joy it works thankyou thankyou thankyou :)


On Thu, 14 Oct 2004 17:18:45 +1000, spent memory <spent.memory at gmail.com>
wrote:
> that makes alot of sense i was infact using multiple handlers ill show you :
> 
>
> setHandler(code,{w32HActivate,w32HChange,w32HGotFocus,w32HLostFocus,w32HKeyDown,w32HKeyPress,w32HClick},routine_id("statbarupdate"))
> 
> 
> On Thu, 14 Oct 2004 06:23:54 +0000, Chris Bensler <bensler at nt.net> wrote:
> >
> >
> > Derek Parnell wrote:
> > >
> > >
> > > posted by: Derek Parnell <ddparnell at bigpond.com>
> > >
> > > spent memory wrote:
> > > >
> > > > can anyone tell me why these 2 lines get the line and column index
> > > > correctlly sometmes with the richedit control i am using, and why it
> > > > doesn't get them correctlly, fo example if i start of at line 1, col 1
> > > > and start tapping the down arrow it increment correctly line 2, line 3
> > > > etc but when i turn around and start hitting the up arrow it takes
> > > > about 2 hits and then starts incrementing down, i cannot work out
> > > > whether this is due to the way the richedit handles {13,10} -
> > > > "\n","\r" , if so does anyone know the flags i should be initialising
> > > > it with :- code below
> > > >
> > > >
> > > > Line = sendMessage(code,EM_LINEFROMCHAR,-1,0)
> > > > Col = w32lo_word(sendMessage(code,EM_GETSEL,0,0)) -
> > > > sendMessage(code,EM_LINEINDEX,-1,0)
> > > >
> > >
> > > Are you issuing these messages on KeyDown or KeyUp? I would recommend
> > > KeyUp as that happens after the RichEdit has moved the caret.
> > >
> > > --
> > > Derek Parnell
> > > Melbourne, Australia
> >
> > Derek is right.
> > I was going to mention, that it sounds like buffered input. Trapping
> > KeyDown will cause a new instance of the keypress to be stored in the
> > input buffer everytime the KeyDown event is polled (as long as you are
> > holding the key). Trapping KeyUp will store one keypress in the buffer
> > for each time the key is released.
> >
> >
> > Chris Bensler
> > Code is Alchemy
> >
> >
> >
> >
> >

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu