Skip to content

Class Functions

Gabriel Inzirillo edited this page Nov 30, 2020 · 7 revisions

In this chapter, we will cover the class functions available. Every function acts as a getter or a setter.

It is not recommended to modify the object directly. You must use the class functions.

Button state

Many function require a first parameter which is the button state. This is to know for which button state you would like to change a property. some constants are given with the components :

  • AJUI_btn_default : "default"
  • AJUI_btn_hover : "hover"
  • AJUI_btn_active : "active"
  • AJUI_btn_disable : "disable"
  • AJUI_btn_focus : "focus"

For example, if you want to change the background color for the on hover state, you must use the AJUI_btn_hover constant as the first parameter

Form.btn.backgroundColor(AJUI_btn_hover;"green")

⚠️ When using a getter with a function that require the state of the button, this first parameter is mandatory in order to know for which state you would like to get the value.

Colors

Colors can be used as defined here SVG Colors.

Index

Global

Button Box

Text

Picture

Composite


name

Description

Name of the button. Must be the name of the form variable widget where you want to bind the button.

Parameter(s)

(text) name

Example

Form.btn.name("btn")

Back to Top


type

Description

Type of button. Only 2 types are possible :

  • rectangle
  • circle

Parameter(s)

(text) type

Default value

rectangle

Example

Form.btn.type("circle")

Back to Top


composition

Description

Button composition :

  • text
  • picture
  • composite

Parameter(s)

(text) button composition

Default value

"text"

Example

Form.btn.composition("composite")

Back to Top


onClick

Description

Callback of the on click event. Can be a formula or a method name. You can pass an object as a parameter to this callback

Parameter(s)

(variant) method name or a formula (object) parameters

Example

Form.btn.onClick("btn_onClick")
Form.btn.onClick(Formula(on_click))
Form.btn.onClick(Formula(ALERT($1.message));New object("message";"hello world"))

Back to Top


onDoubleClick

Description

Callback of the on double click event. Can be a formula or a method name. You can pass an object as a parameter to this callback

Parameter(s)

(variant) method name or a formula (object) parameters

Example

Form.btn.onDoubleClick("btn_onClick")
Form.btn.onDoubleClick(Formula(on_click))
Form.btn.onDoubleClick(Formula(ALERT($1.message));New object("message";"hello world"))

Back to Top


backgroundColor

Alias

bgColor

Description

Background color of the button

Parameter(s)

(text) button state (text) color

Default value

"#4d9ad4"

Example

Form.btn.backgroundColor(AJUI_btn_hover;"green")
Form.btn.bgColor(AJUI_btn_hover;"#fcc728")

Back to Top


cornerRadius

Description

Corner radius of the button's corners.

Parameter(s)

(text) button state (longint) radius

Default value

5

Example

Form.btn.cornerRadius(AJUI_btn_hover;5)

Back to Top


height

Description

Height of the button. If set, this value will only be used if the resizable is set to true. If resizable is set to true and the value of heightis -1 the size will be the one defined in the form variable widget.

Parameter(s)

(text) button state (longint) height

Default value

-1

Example

Form.btn.height(AJUI_btn_default;13)

Back to Top


width

Description

Width of the button. If set, this value will only be used if the resizable is set to true. If resizable is set to true and the value of widthis -1 the size will be the one defined in the form variable widget.

Parameter(s)

(text) button state (longint) width

Default value

-1

Example

Form.btn.width(AJUI_btn_default;120)

Back to Top


resizable

Description

Boolean value that says if we want to resize the form variable widget or not.

Parameter(s)

(boolean) resizable

Default value

False

Example

Form.btn.resizable(True)

Back to Top


padding

Description

Set the padding of the button, cannot be <0.

Parameter(s)

(text) button state (longint) padding

Default value

3

Example

Form.btn.padding(AJUI_btn_default;10)

Back to Top


borderSize

Description

Border size.

Parameter(s)

(text) button state (longint) size

Default value

0

Example

Form.btn.borderSize(AJUI_btn_default;2)

Back to Top


borderColor

Description

Border color.

Parameter(s)

(text) button state (text) color

Default value

"#0a509e"

Example

Form.btn.borderColor(AJUI_btn_default;"blue")

Back to Top


label

Description

Label of the button to be displayed.

Parameter(s)

(text) button state (text) label

Default value

Label

Example

Form.btn.label(AJUI_btn_default;"Click Me!")

Back to Top


fontSize

Description

Font size.

Parameter(s)

(text) button state (longint) size

Default value

16

Example

Form.btn.fontSize(AJUI_btn_default;12)

Back to Top


fontColor

Description

Font color.

Parameter(s)

(text) button state (text) color

Default value

"white"

Example

Form.btn.fontColor(AJUI_btn_default;"lightblue")

Back to Top


fontName

Description

Font name.

Parameter(s)

(text) button state (text) font name(s). Can be different fonts separated by a comma.

Default value

"Arial, Helvetica, MS Sans Serif"

Example

Form.btn.fontName(AJUI_btn_default;"Times")

Back to Top


fontStyle

Description

Font style.

Parameter(s)

(text) button state (text) font style(s). One of those :

  • Bold
  • Italic
  • Underline
  • Strikethrough

Example

Form.btn.fontStyle(AJUI_btn_default;"Bold")

Back to Top


textAlign

Description

Alignment of the text.

Parameter(s)

(text) button state (text) text Align :

  • left
  • center
  • right

Default value

"center"

Example

Form.btn.textAlign(AJUI_btn_default;"left")

Back to Top


horizontalMargin

Description

Horizontal margin. Left and right margin of the text.

Parameter(s)

(text) button state (longint) horizontal margin

Default value

0

Example

Form.btn.horizontalMargin(AJUI_btn_default;10)

Back to Top


picturePath

Description

Path to the picture to display relative to the Resources folder.

You can also use "#" as the root of your picture path. This will only work with an imported AJUI Button template and the picture must be located in the same folder as the template.

Parameter(s)

(text) button state (text) picture path

Example

Form.btn.picturePath(AJUI_btn_default;"images/icons/add.svg")

Back to Top


pictureHeight

Description

Height of the picture.

Parameter(s)

(text) button state (longint) picture height. -1 takes the original height of the picture

Default value

-1

Example

Form.btn.pictureHeight(AJUI_btn_default;24)

Back to Top


pictureWidth

Description

Width of the picture.

Parameter(s)

(text) button state (longint) picture width. -1 takes the original width of the picture

Default value

-1

Example

Form.btn.pictureWidth(AJUI_btn_default;24)

Back to Top


colorToReplace

Description

When using svg as a picture, you can define a color that will be replacing during runtime. For example, you want an icon to change the color on hover. Correspond to the svg fill and/or stroke attributes.

Parameter(s)

(text) color to replace

Example

Form.btn.colorToReplace("black")

Back to Top


replacingColor

Description

Color that will replace the one set with the colorToReplace function.

Parameter(s)

(text) button state (text) color

Example

Form.btn.replacingColor(AJUI_btn_hover;"blue")

Back to Top


pictureOpacity

Description

Opacity of the picture.

Parameter(s)

(text) button state (longint) opacity (0-100)

Default value

100

Example

Form.btn.pictureOpactiy(AJUI_btn_default;50)

Back to Top


pictureRatio

Description

Ratio of the picture.

Parameter(s)

(text) button state (longint) ratio (0-1)

Default value

1

Example

Form.btn.pictureRatio(AJUI_btn_default;0.5)

Back to Top


pictureScale

Description

Scale of the picture related to the button size.

Parameter(s)

(text) button state (longint) scale (0-100). 0 means no scale.

Default value

0

Example

Form.btn.pictureScale(AJUI_btn_default;50)

Back to Top


picturePosition

Description

Picture position. Only for composite button.

Parameter(s)

(text) button state (text) position. Available position :

  • left
  • right
  • top
  • bottom

Default value

"left"

Example

Form.btn.picturePosition(AJUI_btn_default;"right")

Back to Top


pictureAllocation

Description

Picture allocation when the composition is composite. Percentage of the size opf the button allocated to the picture. Only for composite button.

Parameter(s)

(text) button state (longint) allocation (0-100)

Default value

30

Example

Form.btn.pictureAllocation(AJUI_btn_default;50)

Back to Top


activateSecondaryColor

Description

Activate or not the secondary color. Only for compositeand when the picture is not linked to the text.

Parameter(s)

(boolean) activated

Default value

True

Example

Form.btn.activateSecondaryColor(False)

Back to Top


backgroundSecondaryColor

Alias

bgSecondaryColor

Description

Background color of the picture if activated. Only for composite button.

Parameter(s)

(text) button state (text) background color

Default value

"#9fddf9"

Example

Form.btn.backgroundSecondaryColor(AJUI_btn_default;"yellow")
Form.btn.bgSecondaryColor(AJUI_btn_default;"orange")

Back to Top


linkTextToPicture

Description

Link the text and the picture. Only for composite button.

Parameter(s)

(boolean) link

Default value

False

Example

Form.btn.linkTextToPicture(True)

Back to Top


spaceBetween

Description

Space between a linked text and picture. Only for composite button.

Parameter(s)

(text) button state (longint) space

Default value

10

Example

Form.btn.spaceBetween(AJUI_Btn_default;5)

Back to Top

Clone this wiki locally