Le 10 mai 07, à 20:05, Arnaud Nicolet a écrit : > You are using the code in the KeyDown event, right? > That event occurs before the key is actually processed. > > ... > > Try putting it in the SelChange, if it works for you. > ...
> Why do you say "If the user moves the caret with the keyboard arrows, > the only function I can use is selStart()"? You can always use any > function. > You're right again, Arnaud. Thanks. I didn't think SelChange could do that. I imagined it did something else. Now I can close my own bug report... But besides SelChange() and selStart(), I don't see any other option to find out where the caret is. Do you have something else in mind, when you say I can use 'any function' ? Maybe I was a bit unclear : I wasn't talking about events here, just functions that return a position. Thinking further about the keyDown event, I understand it makes sense if it runs its code before the key is processed with a 'return false' statement. But that means that, should I want to get selStart() in the keyDown event, I would have first to code the normal behaviour of a key (i.e., moving the caret if one hits an arrow, inserting a character at the right place if one hits a letter, and any other key-related action) ? That seems like a tedious work ! Is there any way to tell RealBasic, in the keyDown event, "Do what you do normally, and then do what I say." ? By the way, my original goal was to find out not the position of the caret but the number of the line where it is, in other terms, the line number and not the character number. That seems pretty trivial now with LineNumAtCharPos(), but if you see an easier way to do that, please tell me. Many thanks again for your help. Octave _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
