Field shape

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trevix
Posts: 1085
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Field shape

Post by trevix » Tue Aug 25, 2009 12:48 pm

Does anybody knows if it is possible to change the shape of a text field ?
Like having a rounded corner text field ?

Trevix

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Aug 25, 2009 1:01 pm

Buongiorno Roberto,

no, this is not possible!

But you could "fake" this with a borderless field and a graphic (or image) with rounded corners behind it?

You get the picture :)


Best

Klaus

trevix
Posts: 1085
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix » Tue Aug 25, 2009 4:32 pm

mmmh...no.
I use the text flds to show events in a calendar. The rounded corner where needed to show the start and end of the event (a la iCal).
It would be too complex to keep together the graphic and the field, I think (many fields, resizable...).

Any other way you can think of ?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Aug 25, 2009 5:17 pm

Hi Roberto,

no sorry, only more or less complex solutions, like a group consisting of two fields and a graphic.


Best

Klaus

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Tue Aug 25, 2009 7:07 pm

Other than that (and I'm not sure if this is a sensible suggestion) would it help to put a bracket type graphic as the imageSource of the first and last characters in the field?

trevix
Posts: 1085
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix » Tue Aug 25, 2009 10:56 pm

I'm already using the imagesource for different reasons...

I noticed that I can show the name of a rounded rectangle. But it shows in the middle vertical of it and no multiple lines.
Do you think is possible to alter the resource of Rev so as to have more positionable text on it ?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Tue Aug 25, 2009 11:17 pm

trevix,
you can set the label of a graphic, if the show name of the graphic is true then you will see the label instead of the name.

Code: Select all

on mouseUp 
    set the label of graphic 1 to "this is the first line" & cr & "this is the second line" & cr & "and another one"
end mouseUp
but I think a group of field without border and a rounded graphic are more suitable.
regards
Bernd

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Tue Aug 25, 2009 11:35 pm

You can also play about with the text formatting on the graphic, to set left/centre/right alignment, etc - but also in particular you can set the margins.
By default you get one value in the margin box, which will be used for the same margin all the way round. You can set individual left, top, right and bottom margins (in that order) as in 8,8,20,40 which will give a margin of 8 left and top, 20 on the right and 40 at the bottom. If you know your field height will stay the same you can fiddle with the margin to push the text up inside the graphic with a higher bottom margin (say).
You wouldn't be able to have the text autowrap as the field changed width though. You would definitely be better off (IMHO) with a rounded rectangle set to opaque with the background colour set to the same as your field, and a slightly smaller field inside it. If you set them to resize in the same way, they should move and expand together to keep the look consistent. I can't think of a better way to handle it anyway.

Post Reply