Why buttons are Label/Button and nos simply button?

Questions and answers for designing and implementing forms in Servoy

Why buttons are Label/Button and nos simply button?

Postby pentamsi » Mon Nov 12, 2012 10:35 am

I have a doubt about the form elements. I can see, when you put a button in the form is a label/button, not a simply button. And this is causing a little problems for two reasons.

1) When we appy an onRender in a table view form, and this have a footer, header, title header or something with buttons, the buttons are colored to, and this i think is a a mistake.

2) When you travel in the forms elements, and you are ain a button, the type is LABEL and not BUTTON. This I think is a problem, because it's more interesting the element type is a BUTTON and not a LABEL.

Correct me if I'm wrong. If no, i open the case to the servoy support.
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain

Re: Why buttons are Label/Button and nos simply button?

Postby Joas » Mon Nov 12, 2012 3:58 pm

A button and a label are basically the same.

1) If you use the onRender event on the form level, the method is called for all elements on the form, not only the ones in the body. You can use the onRender event on element level instead. Another option is to call element.getElementType() to check which kind of element you are dealing with and not color the buttons.

2) Are you using event.getRenderable().getElementType()? That should return the right type.
Joas de Haan
Yield Software Development
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 774
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL

Re: Why buttons are Label/Button and nos simply button?

Postby pentamsi » Thu Nov 15, 2012 7:37 pm

For the onRender I think actually get the type and separate the labels and the buttons of the text_field, but in a normal mode, we can't find the way to distinct form a label to a button
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain

Re: Why buttons are Label/Button and nos simply button?

Postby david » Wed Nov 21, 2012 3:42 pm

pentamsi wrote:For the onRender I think actually get the type and separate the labels and the buttons of the text_field, but in a normal mode, we can't find the way to distinct form a label to a button


To get around this we use naming conventions: prefix label and button element names with "btn_someButton" and "lbl_someLabel". Then parse the name to figure out the type distinction.

With Servoy 6.1, you can also use the design time property of elements. For example on labels create a property called "type" with a value of "LABEL or BUTTON" and then:

Code: Select all
(forms.someForm[elementArray[x]].getDesignTimeProperty("type") == "BUTTON") ...


But I agree, it would make sense to have a button return BUTTON as its type. :D
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1726
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Why buttons are Label/Button and nos simply button?

Postby pentamsi » Wed Nov 21, 2012 4:14 pm

Thanks for the info david, i tell to my coworker and try it! Thanks!
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain


Return to Forms

Who is online

Users browsing this forum: No registered users and 1 guest

cron