Size

Size allows setting the image height and width in pixels.

There are different ways to change the image of the element: It can be done in Lycia Form Designer or in Lycia Theme Designer. However, it could be more efficient to set the image of the element based on the nature of the element itself:

in Lycia Form Designer:

in Lycia Theme Designer:

Form XML code:

<element_name.image>

<Image imageUrl="..." size="50px, 50px"/>

</element_name.image>

By default, widgets have no images and, thus, this property is absent from the form XML code. The property value will appear in the form XML code only once any image is added to the form.

Theme property filter XML code:

<DoStyleAction>

  <SetProperty>

    <PropertyPath>

      <PropertyName>Image</PropertyName>

      <PropertyName>Size</PropertyName>

    </PropertyPath>

    <PropertyValue type="Size" Width="50px" Height="50px" />

  </SetProperty>

</DoStyleAction>

Possible values: a record of integer values in pixels, em, rem, or qch

Default value: not specified

Associated containers, widgets and theme elements:

TabPage

Button

Canvas

Label

RadioGroup option

ToolbarButton

Inheritance diagram:

Associated ui methods:

setSize

getSize

Influence and behavior:

Regardless of whether you use Lycia Form Designer, Lycia Theme Designer, or ui methods to change the size of the element's image, you can set it in these units:

 

In Lycia Theme Designer, size of the element's image is not specified directly to the Size property but to the placeholder called New Size. New Sizeis an optional ui object (= ui.Size) created to hold the dimensions - width and height - of the element's image:

To specify the size of the element's image, you must set its width ans height in px, em, rem, or qch:

You can also set either width or height, if necessary.

property is not set

(runtime appearance)

property is set

(runtime appearance)

 

If you set the image size in Lycia Theme Designer without filters, it will be applies to all images set to all form elements:

property is not set

(runtime appearance)

property is set

(Lycia Theme Designer)

property is set

(runtime appearance)

As you see above, the Size property can be used to change the size of not only user-set images but default images as well.

 

In Lycia Form Designer, size of the element's image is specified directly to the size property:

default design appearance

property value

(set in the form)

2qch * 3qch

changed design appearance

 

At runtime, you can use ui method - <var>.SetSize() - to change the size of the element's image.

For this purpose, you must

  1. define a variable of the ui.Image data type,
  2. specify the element's image via <var>.SetImageUrl() method applied to this variable,
  3. apply <var>.SetSize() to this variable,
  4. apply the image to the form element by the <var>.setImage() method.

4gl code sample

MAIN

DEFINE btn ui.Button

DEFINE img ui.Image

OPEN WINDOW w WITH FORM "size_ui" ATTRIBUTE(BORDER)

  LET btn = ui.Button.forName("bt1")

    CALL img.setImageUrl("qx://application/middle_lycia.png")

    CALL img.SetSize(["75px", "75px"])

  CALL btn.SetImage(img)

CALL fgl_getkey()

END MAIN

default appearance

(in the form)

runtime appearance

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.