Good day to all.
Maybe someone has already encountered a similar problem ? Maybe someone has already solved this ?
I have an editor gadget. The user selects one line, several lines, or all lines. It doesn't matter if it was a mouse or another method (keyboard). These questions interest me. That is, when a button is pressed, I want to know whether all the text, several lines, or just one line is selected. Maybe even just part of a line. I would like to know the line numbers that were marked. All, even partially selected ones.
Thank you in advance for your answers.
EditorGadget - determine selection
Re: EditorGadget - determine selection
You should really try the forum search first.
On Windows like this, on others search for Shardiks codes.
On Windows like this, on others search for Shardiks codes.
Code: Select all
Define Range.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL, 0, @Range) ; no return value, wParam not used
;
; Range\cpMin ... Character position index immediately preceding the first character in the range.
; Range\cpMax ... Character position immediately following the last character in the range.
;
; Get the Selected Text .....
;
; Text$ = Space(Range\cpMax - Range\cpMin) ; alloc string memory
; SendMessage_(GadgetID(Gadget), #EM_GETSELTEXT, 0, @Text$)
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: EditorGadget - determine selection
Axolotl, thank you !
This is what is needed.
This is what is needed.

