I ve been looking at the MaxIDE code source because i'm willing to try my skills at implementing code completion in it cause damn I can't live without autocompletion...
However, for some reason, I need to know the x/y position of the cursor when it's placed in the text area where the user writes his code...
Here is what I found in the BMaxIDE:
what's interesting here is the Field cursorpos, but seeing the rest of the code, it seems to be the position of the cursor in term of caracters... Anybody having an idea how I could use it (or any other method) to get the x and y coordinates of the cursor (and I don't care if it s the coordinates relative to the top left corner of the textarea or the screen or anything else... just give me some x and y :) )
I thought of doing something like getting the string that precedes the cursor, calling the TextWidth procedure on it to know its graphic length, substract the position of the horyzontal navbar of the textarea... this would probably give me the x coordinate, but I was hoping there would be a cleaner solution.
thanks!!
However, for some reason, I need to know the x/y position of the cursor when it's placed in the text area where the user writes his code...
Here is what I found in the BMaxIDE:
Type TOpenCode Extends TToolPanel Field host:TCodePlay Field textarea:TGadget Field dirty=True Field filesrc$,cleansrc$,cleansrcl$ Field current:TDiff Field undolist:TList=New TList Field redolist:TList=New TList Field helpcmd$,helpstring$ Field seek$ Field cursorpos,cursorlen,cursorline
what's interesting here is the Field cursorpos, but seeing the rest of the code, it seems to be the position of the cursor in term of caracters... Anybody having an idea how I could use it (or any other method) to get the x and y coordinates of the cursor (and I don't care if it s the coordinates relative to the top left corner of the textarea or the screen or anything else... just give me some x and y :) )
I thought of doing something like getting the string that precedes the cursor, calling the TextWidth procedure on it to know its graphic length, substract the position of the horyzontal navbar of the textarea... this would probably give me the x coordinate, but I was hoping there would be a cleaner solution.
thanks!!