i want to "mark" Text in a EDITBOX so i need 2 Position
using "CaretPos" i got 1st Position and add LEN(Text) is 2nd Position.
so how to
Code: Select all
setMarked( { nFrom, nTo } )
Moderator: Rathinagiri
Code: Select all
setMarked( { nFrom, nTo } )
Code: Select all
// set focus
DoMethod( "Form_1", "Editbox_1", "SETFOCUS" )
// remove marked text and insert the replacement
API_SelectRange( nFrom - 1, nTo - 1 ) // ZERO-based
// why does this not work ???
API_ReplaceSelection(@cReplace)
Code: Select all
PROCEDURE API_SelectRange( nStartIndex, nEndIndex )
LOCAL hEdit := GetProperty( "Form_1", "Editbox_1", "Handle" )
DoMethod( "Form_1", "Editbox_1", "SETFOCUS" )
SendMessage( hEdit, EM_SETSEL, nStartIndex, nEndIndex )
RETURN
Code: Select all
PROCEDURE API_GetSelection( nStart, nEnd )
LOCAL hEdit := GetProperty( "Form_1", "Editbox_1", "Handle" )
DoMethod( "Form_1", "Editbox_1", "SETFOCUS" )
SendMessage( hEdit, EM_GETSEL, @nStart, @nEnd )
RETURN
Code: Select all
PROCEDURE API_ReplaceSelection( cText )
LOCAL hEdit := GetProperty( "Form_1", "Editbox_1", "Handle" )
DoMethod( "Form_1", "Editbox_1", "SETFOCUS" )
SendMessage( hEdit, EM_REPLACESEL, TRUE, cText )
RETURN
Code: Select all
// remove marked text and insert the replacement
// why does this not work ???
// ::ReplaceSelection(@cReplace)
// Workaround : use Clipboard
System.EmptyClipboard
System.Clipboard := cReplace
::API_Paste()
System.EmptyClipboard