Selecting a line of text

11 views
Skip to first unread message

Terry Michaels

unread,
Apr 21, 2026, 2:03:00 PM (8 days ago) Apr 21
to SuperCard Discussion
I am disabled and old, and I am not a great programmer.
Please help me remember how to select a line of text in a field.
I am doing something wrong.
I often depend on copying old scripts and apparently I no longer have that one.

Bill Bowling

unread,
Apr 21, 2026, 2:40:31 PM (8 days ago) Apr 21
to superca...@googlegroups.com
Terry,

I spent a a minute using the ChatGPT machine. I haven’t tested but the syntax appears correct.

Here are a few simple examples you can pass along.


Select a specific line

select line 3 of fld "MyField"

Find text, then select that line

put lineOffset("Smith", fld "MyField") into tLine
if tLine > 0 then
select line tLine of fld "MyField"
end if

Using a variable

put "Smith" into ss1
put lineOffset(ss1, fld "MyField") into tLine
if tLine > 0 then
select line tLine of fld "MyField"
end if

Select a word (by position)

select word 2 of fld "MyField"

Select a character range

select char 1 to 10 of fld "MyField"

Field properties that matter

These can affect whether selection works as expected:

set the lockText of fld "MyField" to true (list field)
  • lockText = true → user cannot edit text
  • Selection still works, but field behaves more like read-only
set the dontWrap of fld "MyField" to true
  • Prevents line wrapping (important when using line numbers)
set the autoSelect of fld "MyField" to true
  • Clicking selects entire lines (useful for list-style fields)
set the multipleLines of fld "MyField" to true
  • Required if you want multiple lines at all

Common gotchas

  • Always check result of lineOffset or wordOffset (0 = not found)
  • Avoid nesting expressions inside select
  • Wrapping can change what counts as a “line”
  • Field must be visible and not empty
- Bill

Terry Michaels

unread,
Apr 21, 2026, 3:18:01 PM (8 days ago) Apr 21
to SuperCard Discussion
Solved, thank you, Bill!
Reply all
Reply to author
Forward
0 new messages