Bug? B4XDialog (XUI Views) in combination with a TextArea

PaulMeuris

Well-Known Member
Licensed User
The text alignment in a TextArea will change if you use a B4XDialog.
In this example the TextArea is partially covered by a white pane to show the effect better.
The dialog initialization is commented out.

And now when you remove the comment from the dialog.Initialize(Root) line then the TextArea looks like this:

The text has moved down.
The initialization code from the B4XDialog contains the following code:
B4X:
    #if B4J
    Dim node As JavaObject = mParent
    Dim stylesheets As List = node.RunMethodJO("getScene", Null).RunMethod("getStylesheets", Null)
    stylesheets.Add(File.GetUri(File.DirAssets, "Dialog.css"))
    #End If
You could comment out this code in a copy of the B4XDialog class...
OR you could create an empty text file, name it "Dialog.css" and add it to the files manager of your project.
After that the TextArea text alignment is back to "normal".

Notes:
- @Erel doesn't recommend the use of CSS in a B4XDialog.
- in my pmfiles tutorial in message #5 i explained a possible other issue of the B4XDialog CSS file in combination with a Codemirror CSS file with the same name.

So now you know what to do if you encounter this issue.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Dialog.css does change the default padding:
B4X:
.text-area .content {
    -fx-padding: 15 5 5 5;
}

There was a reason for this. Related to some of the templates.
As you wrote, you can workaround it by adding the attached css file to your project and removing this section.
 

Attachments

  • Dialog.css.zip
    372 bytes · Views: 78
Cookies are required to use this site. You must accept them to continue using the site. Learn more…