|
-
September 27th, 1999, 01:39 AM
#1
converting caret postion in text box to pixel grid position
Hay People,
I am trying to write an editor that will similarly to the VB editor - will open a list box after a dot was pressed.
I am using the GetCaretPos func from user32 lib to find my caret position.
But, when assigning these caret coordinates to the left and top properties of the list box - the list box will appear not at the caret position but with an offset that will grow the further the caret is.
So, my questions are:
A) What kind or in what grid is the caret position?
B) How can I convert the caret position to the "general" pixel grid position that will allow other controls match the caret position
Hope I am clear enough with my question...
Thanks in advance
Dani.
-
September 27th, 1999, 02:20 AM
#2
Re: converting caret postion in text box to pixel grid position
If you look into MSDN, it says GetCaretPos
will return the caret position with respect to Client Coordinates. So its origin will coincide with the (Rich) Edit control that you may be using.
You can use ClientToScreen, ScreentoClient APIs to convert the coordinates to Scrren coordinates and use absolute positioning.
Yet Another thing that will affect the position of your Listbox is its parent control. So, if you want relative positioning you need to add/subtract values that correct for the Parent's (left,top) values.
RK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|