Spacing between lines on buttons

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: Klaus, FourthWorld, heatherlaine, kevinmiller

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

Oh wait, I think I misunderstood what you were asking for heh. I interpreted 'center vertically' to mean one word below the other in vertical alignment :oops:

However, you can still center it, no matter how large the text field, by adjusting the margins, although that might take some experimentation (plugging numbers in).
Centering through margin...
Centering through margin...
Image
KimD
Posts: 225
Joined: Wed Jul 08, 2015 5:51 am

Re: Spacing between lines on buttons

Post by KimD »

Hi Bogs

Yes, I agree. If the size of the control is fixed and the number of lines of text content is fixed, then the Property Inspector is an easy way to vertically centre the text in a field.

The advantage that buttons have is that they automatically vertically centre their labels without these two conditions needing to be true. But, as people have said in the earlier replies to this post, button labels don't support some of the other (very useful) text formatting features that Fields have.

Thanks (all) for your fast / comprehensive input

Kim
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

KimD wrote: Thu Apr 19, 2018 10:31 pm The advantage that buttons have is that they automatically vertically centre their labels without these two conditions needing to be true.
Agreed, but far as I know, you have to write multi line labels through code, like your "Hello" & cr & "World" line, at least here I wasn't able to do that in the label box in the PI, where as you could just enter the text in the contents box of a field.

I'd still run with the kludge I mentioned above, if I needed a particular look for some odd reason :twisted:
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: Spacing between lines on buttons

Post by dunbarx »

The label field in the inspector is multi-line. But it is a little odd.

If you simply enter some text, a return and some more text, it does not, at least in 8.1.8, show that multi-line feature until you change panes and go back, even though the button label shows it instantly. And if you set externally, the inspector will not update until that pane is reloaded.

This is likely a very minor bug.

Craig
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

dunbarx wrote: Fri Apr 20, 2018 3:36 am The label field in the inspector is multi-line. But it is a little odd.
Sorry, I should have posted a picture. When I said
bogs wrote: Thu Apr 19, 2018 10:57 pm you have to write multi line labels through code, like your "Hello" & cr & "World" line, at least here I wasn't able to do that in the label box in the PI...
I was talking about this label box in the PI,
Selection_003.png
Selection_003.png (5.68 KiB) Viewed 8125 times
not a label object where your filling in the contents :oops:

As far as I know, to make a multi line button label, you have to do that through code. I'd be happy to stand corrected though :mrgreen:
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: Spacing between lines on buttons

Post by dunbarx »

Bogs.

Make a new button. Make it a bit larger.
Type "Hello & return & "World" into the label field in the inspector.
Watch the button. And if you carefully watch the label field, you will get a clue as to the fact that this is indeed working.
Open any other tab in the inspector, like the custom prop tab.
Open the main tab again. You now see a multi-line label field. And it now sticks.

Craig
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

Well, it doesn't seem to work that way here (on Linux or on Windows), unless I am taking you too literally.
Windows Lc8.1.8
Windows Lc8.1.8
But, I think I did finally figure out a couple of things.
  1. my initial tests were done in much earlier versions which (apparently) don't have multiline button labels in the PI, but you can do through code, and
  2. in the versions it *does* work on, just hitting the enter key puts it on the next line
Windows Lc8.1.8
Windows Lc8.1.8
Selection_005.png (17.09 KiB) Viewed 8062 times
My apologies to Kim, I didn't think of testing past trying to put the actual "Hello & return & "World" into the label field in the inspector, which did not work in linux or windows.
Image
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: Spacing between lines on buttons

Post by dunbarx »

Hmmm.

The recipe I laid out works on Mac OS 10.9, LC 8.1.8.

It is just a funny redraw glitch in the PI. The button itself reacts as soon as the entry is terminated, usually by just clicking somewhere or changing panes.

Anyway, a minor oddity; the label field supports multi-line.

But Bogs, your PI shows the expected multi-Line field. So in Linux and Windows there is NOT that glitch?

Craig
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

In windows there is not the glitch, in Linux you only see a single line.
Image
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Spacing between lines on buttons

Post by bogs »

dunbarx wrote: Fri Apr 20, 2018 10:50 pm The recipe I laid out works on Mac OS 10.9, LC 8.1.8.
I finally had a chance to test on Mac OSX 10.6.6 (highest I can do) and Lc 8.1.8. I still think I somehow took the original formula too literally.
Selection_003.png
As soon as I tabbed out of the label field, just as on windows and linux, this updated the button without switching tabs on the PI
Selection_004.png
When put in this way, tabbing out, switching tabs in the PI, nothing changed the result.
Image
Post Reply