SetSelect = place/select in string field

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

SetSelect = place/select in string field

Post by WilliamL »

A feature I would like to request is one I hope will be of general interest to all platforms.

With all credits and copywrights to the creators of 'FutureBasic', I would like to quote a modified portion of their reference manual.

edit field here is the same as StringGadget/ListViewGadget/ListIcontGadget/etc
Syntax: SetSelect startSelect%, endSelect%

Description:

If the current output window contains an active edit field, this statement selects (highlights) a
range of text in the field, or sets the position of the blinking insertion point. It also scrolls the
selected text into view, if it’s not already in view.

The startSelect% and endSelect% parameters refer to positions between characters in the
field. Position 0 is just to the left of the first character; position 1 is between the first and second
characters; and so on. If you specify a position greater than or equal to the number of characters
in the field, it indicates a position just to the right of the last character. If startSelect% equals
endSelect%, then no text is highlighted, but a blinking insertion point is paced at the indicated
position.

Example:
If you specify SetSelect 0,0, a blinking insertion point is placed at the beginning of the
field’s text. If you specify SetSelect 0,32767, all of the text in the field is selected. If you
specify SetSelect 32767,32767, a blinking insertion point is placed at the end of the field’s
text.

Use the Window(_selStart) and Window(_selEnd) functions to determine the active field’s current selection range.
note that the functions to get the active field's current selection range is important

PS FutureBasic is no longer being sold but is now a freeware project called FBtoC at http://4toc.com/fb/index.htm
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Post by Seymour Clufley »

On Windows at least, you can do this with API. I don't know about the other platforms. But yes, a native command would be helpful.
Post Reply