Label, not all parameters can be set in blocks

I play a little with components. Now I'm researching the label. I noticed that the alignment parameter is disabled in blocks. For the test, I turned on the visibility of these parameters in blocks. Unfortunately, although blocks are set to 1 (center) for horizontal alignment, the text is still left-aligned. The return value block works fine and returns 1. The alignment only reacts to settings in the designer. I wanted to add a few features to the label, and unfortunately the same is happening to them. They work in designers, not in blocks.

@Patryk_F can I see what you changed in the source code?

@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TEXTALIGNMENT,
      defaultValue = Component.ALIGNMENT_NORMAL + "")
  @SimpleProperty(
      userVisible = false)
  public void TextAlignment(int alignment) {
    this.textAlignment = alignment;
    TextViewUtil.setAlignment(view, alignment, false);
  }

Change userVisible to true. The alignment block will appear in blocks. But unfortunately it doesn't respond. Only in the designer can I change the alignment. Why?

1 Like

I am really surprised, although I mention my PR and I want to say that when I created PR I test it and PR not comparing value from getter and setter you can see this into PR.

tomorrow I will try this and come with some thing useful.

I also added Clickable (), setLinksClickable() and Marquee it works in blocks.

I've also added a link type property, but it only works in the designer.
setAutoLinkMask()

I don't know about github, I'm testing it on the current version ai2 nb186. Your patches are definitely on the test server.

1 Like

@preetvadaliya, this was the root of one of @Susan_Lane's comments on a related PR. Just because you see that the state can be retrieved does not mean that it accurately reflects the user's expectations. What you really need to do in the tests is verify that the part of the Android subsystem that should reflect the change does so, not just that the setter/getter return the right values.

@Patryk_F, I haven't tested by you may need to call view.invalidate(); or similar to mark the view as needing to be refreshed. You may also want to take a look at this PR by @bartmathijssen , which does implements some of what you're trying to do:

https://github.com/mit-cml/appinventor-sources/pull/1913

3 Likes