Hi björn...
it seems to me that you are complicating your code for nothing... I just
tested for a fex minutes and here is something working:
<CODE>
POINT is structure
x is int //Type C : LONG
y is int //Type C : LONG
END
stPoint is POINT
stPoint:x = MouseXPos
stPoint:y = MouseYPos
n is int=SendMessage( Handle(EDIT_RTFTEXT), 215 , 0, &stPoint )
//EM_CHARFROMPOS
RTFInsert(EDIT_RTFTEXT,"TOTO",n)
</CODE>
As you can see, I removed the dnd from the problem to simplify, and I'm
just using the mouse position... The EM_PosFromChar message RETURNS the
position you need, so you can use it directly in the rtfInsert
Of course, this code for on the mouseover portion of the RTF field code,
and would insert hundreds of times TOTO, one after the other...
But it should give you what you need
Best regards
--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting
More information on [
www.fabriceharari.com]
Superdan wrote:
> Superdan wrote:
>> OK..ay ... what I want do to is to drag a table item //table.custname//
>> into an RTF control. No problem so far.
>> The thing I am twiddling with is that I DON'T want to drop the custname
>> value at the CARET !! (the blinking beam) position, INSTREAD I want to
>> insert the value at : _DnDMouseXPos, _DnDMouseYPos withing my RTF text.
>>
>> So : RTFInsert(RTF, droppedValue, RTF..Cursor) is not an option.
>>
>>
>> If I recall correctly there exist a solution, just can't remember where
>> I have to look....
>>
>> Thanks, björn
>
> I tried to use the CharFromPosition message / EM_CHARFROMPOS -> 0x00D7/
> ========================================================================
>
> POINT is structure
> x is int //Type C : LONG
> y is int //Type C : LONG
> END
> stPoint is POINT
>
>
> IF ControlOver() = "EDIT_RTFTEXT" THEN
>
> stPoint:x = _DND.MouseXPos // SCRTF_START.EDIT_RTFTEXT..x
> stPoint:y = _DND.MouseYPos // - SCRTF_START.EDIT_RTFTEXT..y
>
>
> SendMessage( Handle(SCRTF_START.EDIT_RTFTEXT), EM_CHARFROMPOS , 0,
> &stPoint )
> // vice versa ??? POSFROMCHAR ...and than ...->
> n is int = API("USER32", "SetCaretPos", stPoint:x, stPoint:y)
>
> IF n THEN
> // Gotcha
> API("USER32","ShowCaret", Handle(SCRTF_START.EDIT_RTFTEXT) )
> ELSE
> //Trace("Can't set caret position")
> END
>
> END
>
> Trace(n)
> RTFInsert( SCRTF_START.EDIT_RTFTEXT, DnDGetData(CF_TEXT),
> SCRTF_START.EDIT_RTFTEXT..Cursor )
>
> ===========================================================================
>
> Well that wont not work, of course, this snippet is just a completely
> destroyed fragment, written in hope that somebody more inspired than me
> is able to help.
>
> However, I think the solution is around the EM_CHARFROMPOS
> /EM_POSFROMCHAR et al. message family...
>
>
>
>
>
>
>
>
Message forwarded from pcsoft.us.windev