March 28, 2024, 03:38:34 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Position in an edit control

Started by Andy, January 21, 2020, 06:31:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Can't see anything posted about this, so I'll ask:

If I have and edit control, and in it are some words say...

These are some words

And I place the edit position in front of the word "are", which would be position 7 in the string of these words, how can I get that position i.e. 7?

Can this be done any one?
Any examples you can post please?

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

January 21, 2020, 07:05:36 AM #1 Last Edit: January 21, 2020, 07:56:09 AM by Brian
Not sure, but does GetCaretPos do the trick?

Brian

On looking, I think it must be this SENDMESSAGE:

https://docs.microsoft.com/en-us/windows/win32/controls/em-getcaretindex


LarryMc

The proper IWB command for finding the 0 based index of the caret in a line is:

CONTROLCMD window | dialog, ID, @EDGETSELECTION, varStart, varEnd

If nothing is selected then varStart=varEnd = 0 based index of caret
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks guys,

Will give it whirl!

Andy.
 :)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.