Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Dynamically created buttons  (Read 7394 times)
Graham H.
Posts: 8


« on: December 10, 2008, 11:28:30 am »

I have code which correctly creates buttons on the screen.
However, the statement b.setAttribute("backgroundColor", "red") crahes the application with the error
"The attribute backgroundColor does not belong to node Button", which is untrue since it can be defined in a style.
Similarly a button defined in a .per file can have "justify = center" which puts the text in the middle of the button.  The facility appears to be unavailable as a style attribute.
Sebastien F.
Four Js
Posts: 509


« Reply #1 on: December 10, 2008, 11:57:11 am »

Graham,

The backgroundColor attribute is not an attribute of Button, so it's normal that you get this error.

The purpose of styles is to define decoration attributes indirectly through a style name.

You should define a style for your buttons defining the backgroundColor attribute, then set the style attribute in programs with:

   CALL form.setElementStyle("name", "mystyle")

https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/ClassForm.html#setElementStyle

Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines