Page 1 of 1

Why buttons are Label/Button and nos simply button?

PostPosted: Mon Nov 12, 2012 10:35 am
by pentamsi
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.

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

PostPosted: Mon Nov 12, 2012 3:58 pm
by Joas
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.

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

PostPosted: Thu Nov 15, 2012 7:37 pm
by pentamsi
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

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

PostPosted: Wed Nov 21, 2012 3:42 pm
by david
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

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

PostPosted: Wed Nov 21, 2012 4:14 pm
by pentamsi
Thanks for the info david, i tell to my coworker and try it! Thanks!