I am using the solutionModel to generate Servoy screens but have been unable to figure out hos to add a rounded rectangle, or even a plain rectangle to my screen.
Can anyone explain how to do that?
thanks,
Terry
I am using the solutionModel to generate Servoy screens but have been unable to figure out hos to add a rounded rectangle, or even a plain rectangle to my screen.
Can anyone explain how to do that?
thanks,
Terry
Hi Terry,
just use an empty label with borders.
It’s not the rectangle you have available at design time, but the closest thing to have.
The rectangle is not exposed in the solutionModel API
Hope this helps.
Here is some sample code to create a label with a rounded border:
var jsForm = solutionModel.getForm(controller.getName());
var jsRectangle = jsForm.newLabel("rectangle", 10, 10, 300, 100);
jsRectangle.borderType = solutionModel.createRoundedBorder(1,1,1,1, "#000000", "#000000", "#000000", "#000000", [10, 10, 10, 10], null);
controller.recreateUI();
Many thanks to Joas and Marc.
It does bed the question as to WHY “The rectangle is not exposed in the solutionModel API”?
cheers,
Terry
This worked for me except that the rectangle was opaque.
Seems that you can set its transparent property to true.
Terry
So I have my rectangle surrounding some text fields.
The rectangle is transparent so those text fields are visible. But when I try to click on one of those fields the rectangular label gets the click so I can’t get to any of the other items inside the rectangle!
Is there a way to do that? To get the label to ignore clicks and let them get to the other items?
thanks,
Terry
Whether an element is on the foreground or not depends on its formIndex-property.
To be in the background, the formIndex of your rectangle needs to be lower than the formIndex of your fields.
Setting it to -1 will probably do the trick:
jsRectangle.formIndex = -1;
One question. Why do you use solutionmodel?
And it is probably better and easier to maintain to use a styleclass to create the border… Just add a label and assign a styleclass that takes care of its appearance.
It was asked “Why do you use solutionmodel?”.
We are porting our SnappMX-/Flash-based application to Servoy.
SnappMX provides XML-based screen descriptions. We are generating corresponding Servoy forms using the solution model.
thanks,
Terry