HOW TO: set a border property on a field

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

HOW TO: set a border property on a field

Postby Providence1 » Wed Feb 17, 2010 5:23 pm

This is for my own freaking edification because there is nothing on the forum and nothing in the documentation about how to do this and I have to search my own solution each time for the answer when it should be a simple google search away for everyone...

Three parameters should be defined when setting the border property to a field: the kind of border, the thickness, and the color.

These should be enclosed in quotes because they are passed as a string.

so...
Code: Select all
element.setBorder.('LineBorder,1,#ff0000')


I've specified that the border of my field should be a line ( because really a border could could be any number of things: Etched, Line, SpecialMatte, etc) , it should have thickness of 1 (this can be done in whole integers) and it should have the color blood red because I like my near sighted and color blind users to know that there's an issue with this field and that they haven't done something correctly. (Users... who need 'em).

Oh, and if you want to set a border to empty ( I've read this should be done on an onShow but I've successfully tested it elsewhere), here's how:

Code: Select all
elements.setBorder("EmptyBorder,0,0,0,0")


Sardonic diatribe ends now...
Providence
Providence1
 
Posts: 456
Joined: Tue Aug 17, 2004 2:36 am
Location: New York, NY

Re: HOW TO: set a border property on a field

Postby ptalbot » Wed Feb 17, 2010 7:33 pm

A suggestion to Paul Bakker: The exact syntax of all the types of borders should be in the wiki.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: HOW TO: set a border property on a field

Postby rgansevles » Thu Feb 18, 2010 11:14 pm

In the mean time you can also find out the border format by setting format you want on a field using Servoy Developer and copy the string from the .frm-file.

Code: Select all
borderType:"TitledBorder,Hello,2,2,DialogInput.plain,0,11,#0000ff"


Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: HOW TO: set a border property on a field

Postby kwpsd » Sat Mar 06, 2010 7:48 pm

In Servoy 5.1, the code and sample helpers need work, too! The helper says:

void setBorder(spec)


but when you copy the sample code, it presents the following example:

var b = elements.elementName.setBorder('Line,1,1,#ccffcc');


Note, one has an unknown return type and the other a return type of 'void'.

Also, the sample helper show a specification of 'Line,1,1,#ccffcc' that does not work and should be 'LineBorder,1,1,#ccffcc'.

I hope this helps!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA


Return to How To

Who is online

Users browsing this forum: No registered users and 9 guests