solutionModel and Rectangles

Questions and answers for designing and implementing forms in Servoy

solutionModel and Rectangles

Postby tkilshaw1553613063 » Tue Mar 26, 2019 5:25 pm

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
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: solutionModel and Rectangles

Postby mboegem » Tue Mar 26, 2019 6:22 pm

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.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1573
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: solutionModel and Rectangles

Postby Joas » Tue Mar 26, 2019 6:39 pm

Here is some sample code to create a label with a rounded border:
Code: Select all
   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();
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 833
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: solutionModel and Rectangles

Postby tkilshaw1553613063 » Tue Mar 26, 2019 10:37 pm

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
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: solutionModel and Rectangles

Postby tkilshaw1553613063 » Tue Mar 26, 2019 11:24 pm

This worked for me except that the rectangle was opaque.

Seems that you can set its transparent property to true.

Terry
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: solutionModel and Rectangles

Postby tkilshaw1553613063 » Wed Mar 27, 2019 10:31 pm

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
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: solutionModel and Rectangles

Postby Joas » Thu Mar 28, 2019 6:32 am

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:
Code: Select all
jsRectangle.formIndex = -1;
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 833
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: solutionModel and Rectangles

Postby rvanderburg » Thu Mar 28, 2019 9:58 am

One question. Why do you use solutionmodel?
rvanderburg
Site Admin
 
Posts: 68
Joined: Wed May 04, 2011 10:28 am

Re: solutionModel and Rectangles

Postby patrick » Thu Mar 28, 2019 10:11 am

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.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3692
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: solutionModel and Rectangles

Postby tkilshaw1553613063 » Thu Mar 28, 2019 11:28 pm

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
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 6 guests

cron