LabelPlus - Additional methods for the Label component

Blocks:

- These blocks set and return whether the entire label is clickable (true) or not (false).


blocks - 2021-05-30T195134.770

blocks - 2021-05-30T195137.952

- This block sets some of the label text to be a clickable link. The text is determined by the position of the first character and the length of the text.


- This event detects clicks on the label and clicks on the clickable text. When clicking on a label, it returns component and empty text. When clicking on text, it returns the component and the clicked text.


- This event detects long clicks on the label. When long clicking on a label, it returns component. (NEW in v3)


- These blocks are used to set and return what kind of direct links to detect in the label. These links are clickable and will open in the default apps on your phone. We define the types of detected links using green blocks. We can also set the color of the links.


component_set_get (28)

component_set_get (29)

component_set_get (30)

component_set_get (31)

component_set_get (32)

blocks - 2021-05-30T205506.486

- These blocks set and return whether multiline text is to be aligned on both sides by extending a space. *I noticed that justification crashes after using any link setter. I have not been able to find the cause so far.*


blocks - 2021-05-30T203756.500

blocks - 2021-05-30T203801.268

- These blocks set and return whether the label text should be selectable. We can select the text, for example, to copy it. We can also set the color of the selection.


blocks - 2021-05-30T210310.886

blocks - 2021-05-30T210313.984

- These blocks return whether the label contains highlighted text, and the position of the beginning and end of the selection.


blocks - 2021-05-31T215241.988

- These blocks set and return the method of truncating the text to one line. The green blocks are used to select the method. The START, MIDDLE and END methods truncate the text and place 3 dots at the beginning, middle or end of the text. The MARQUEE method scrolls the text. *These methods do not work when text is selectable.*


component_set_get (23)

component_set_get (24)

component_set_get (25)

component_set_get (26)

component_set_get (27)

- These blocks manage the number of lines in the label. Set and return the count of lines.


blocks - 2021-05-30T211841.991

- These blocks set and return text alignment horizontally.


component_set_get (20)

component_set_get (21)

component_set_get (22)

- Set a shadow under text of the specified blur radius and color, and the specified distance from text position.


blocks - 2021-05-31T213400.441

- Sets a custom font for the label. You must add the font file to the app's resources. (NEW in v3)


- Sets the colors and shape of the label. (NEW in v3)


bgColorList - color list for label background gradient, if the list is single element, then the color will be uniform.
gradientOrientation - gradient orientation, four orientation properties (green blocks) are available.
borderWidth - sets the width of the label border, if you do not want the border, set the value to 0.
borderColor - sets the color of the label border, if you don't want the border, set the value to any numeric value or any color.
padding - sets the text spacing from the edges of the label. Useful for a border so that the text does not overlap the border.
radius - sets the radius of the rounded corners, if you don't want rounding set the value to 0.

component_set_get(1)

component_set_get(4)

- Sets the color gradient for the label text. This also changes the color of the links. (NEW in v3)


- Sets the height to elevate label. Creates a shadow under the label. (NEW in v3)


Extension v3:

com.extension.LabelPlus.aix (21.9 KB)

Demo project showing the possibilities:

TestLabelPlus2.aia (20.9 KB)

18 Likes

Nice Extension :+1:

2 Likes

Also for constants you should use the naming conventions... for example
LinkTypeWEB_URLS should be LinkTypeWebUrls
etc

Taifun

2 Likes

During construction, at the beginning I had it. Later I changed to make the type of the constant more visible. I have a few more ideas so I will update and rename.

3 Likes

Great Extension! thanks a lot!

1 Like

Great extension !

1 Like

@Patryk_F to make the block image looks normal you have to download the image in this way.
First, do not left-click on the block, but left-click on the block editor, for example :

Screenshot (19)

@Patryk_F very good extension.
I am also thinking for similar to this I want to add spannable string support If I get time in summer I will discuss with mentor on this project.

2 Likes

I have a source of Label component with the above methods implemented. I can send you a file, you will change, you will improve, maybe some work will save.

1 Like

Yes I know about it. Here I just downloaded individual blocks from a sample project. I think it does not matter, blocks are visible and readable.

1 Like

I updated the extension.

  • new blocks added,
  • improved naming
2 Likes

Awesome Tool! :+1:

Possible to add a "long click" option so that accidentally brushing against the label does nothing?

1 Like

Thx. Yes, I can add that. I have a few more new ideas that I will also add and update the extension.

1 Like

Ultra cooooool extension !!!

1 Like

Is the modified extension available for download now?
If so, what is the URL?

1 Like

Nice extension!

1 Like

The link to the latest aix is at the bottom of the first post in this topic.

Not yet. Give me some time as I have other activities besides ai2 :blush:.

Hi @Patryk_F Great job, it works perfect :100:
Can we use the extension for textbox instead of labels. It would be so helpful if it worked for textbox as well.

My need is just that link blocks. detect links, numbers from a textbox.

1 Like

I'm in the process of working on an extension for the textbox. I will see how this method works with textbox.

1 Like