Apply hanging indent style to only a specific line?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MichaelBluejay
Posts: 222
Joined: Thu Jul 01, 2010 11:50 am

Apply hanging indent style to only a specific line?

Post by MichaelBluejay » Thu Nov 05, 2020 8:50 pm

Can I select some text in a field, click a button, and have that text (and only that text) formatted as a hanging indent?

I've seen recipes that involve setting the leftmargin of the field, but that affects every line in the field, on all cards, which is not what I want. I want to format only a specific paragraph as a hanging indent on demand.

My current method is to select the text in LC, copy it to the clipboard, switch to TextEdit (Mac text editor), past the text, create the hanging indent with the ruler, select the text, copy it to the clipboard, switch back to LC, select the text, and paste the formatted text back in. This is cumbersome, to say the least.

I imagine there a convoluted way by copying the rtftext of the field to a variable, finding the right line in that string (somehow), adding the hanging indent code, setting the entire text of the field to the rtftext variable, then restoring the selection or insertion point.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Apply hanging indent style to only a specific line?

Post by Klaus » Thu Nov 05, 2020 9:36 pm

Hi Michael,

check -> firstindent in the dictionary, sounds like that is what you are looking for! :-)


Best

Klaus

MichaelBluejay
Posts: 222
Joined: Thu Jul 01, 2010 11:50 am

Re: Apply hanging indent style to only a specific line?

Post by MichaelBluejay » Thu Nov 05, 2020 10:10 pm

Like I said, I don't want to set the leftmargin of the field, and doing a hanging indent with firstindent seems to require that.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3991
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Apply hanging indent style to only a specific line?

Post by bn » Thu Nov 05, 2020 10:42 pm

Hi Michael,

set the leftIndent to e.g 17 and the firstIndent to -17 for a paragraph.

Code: Select all

on mouseUp
    lock screen
    set the leftIndent  of line 2 of field 1 to 17
    set the firstIndent of line 2  of field 1 to -17
    unlock screen
end mouseUP

See attachement "Paragraph Formatting Properties"


LiveCode55DP1field.livecode.zip
(25.96 KiB) Downloaded 181 times


Kind regards
Bernd

MichaelBluejay
Posts: 222
Joined: Thu Jul 01, 2010 11:50 am

Re: Apply hanging indent style to only a specific line?

Post by MichaelBluejay » Fri Nov 06, 2020 12:02 am

That did it, thanks!

Thunder
Posts: 20
Joined: Thu Mar 12, 2015 1:52 pm

Re: Apply hanging indent style to only a specific line?

Post by Thunder » Tue Nov 10, 2020 12:58 am

Hi.

LiveCode55DP1field.livecode crashes on Windows 10 Home.
Livecode 9.6.1

1) Run LiveCode55DP1field.livecode in the IDE.

2) Select the word You in the second paragraph.

3) Click the button : Flag Selection.

4) Click the button : Transfer Selection.

5) LiveCode crashes without warning.


If you try the above without clicking on button Flag Selection then
everything is OK.

Anybody else experiencing this ?

Sincere
Thunder

bn wrote:
Thu Nov 05, 2020 10:42 pm
Hi Michael,

set the leftIndent to e.g 17 and the firstIndent to -17 for a paragraph.

Code: Select all

on mouseUp
    lock screen
    set the leftIndent  of line 2 of field 1 to 17
    set the firstIndent of line 2  of field 1 to -17
    unlock screen
end mouseUP

See attachement "Paragraph Formatting Properties"



LiveCode55DP1field.livecode.zip



Kind regards
Bernd

SteveFI
Posts: 30
Joined: Tue Mar 16, 2021 6:15 pm

Re: Apply hanging indent style to only a specific line?

Post by SteveFI » Fri Apr 09, 2021 8:39 pm

This has really helped me out. Wow, there is quite some fine text control in LC but it's knowing where to look!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”