German Frage zu B4J

normank

Member
Licensed User
Longtime User
Hallo und frohe Weihnacht,
ich habe gerade etwas Zeit gefunden mich mit B4J zu befassen, mein erster Eindruck : "genial" !

Aber dann bekam ich doch ein Problem: Ich wollte ein Pane per Quelltext in ein leeres Form ein fügen,
ohne Erfolg.
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
   
    Dim pn As Pane
   
End Sub
 
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
   
       
    pn.Initialize("pn")
    MainForm.RootPane.AddNode(pn,0,0,100,100)
    pn.Style=" -fx-background-color:red"
   
   
    MainForm.Show
End Sub

Sollte ein rotes Quadrat erben, aber es wird nicht angezeigt. Was mache ich falsch ?
norman
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is a bug. The PrefWidth and PrefHeight should have been set automatically. It will be fixed in the next update.
For now you can set them yourself:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
  MainForm = Form1
   
  pn.Initialize("pn")
  MainForm.RootPane.AddNode(pn,0,0,100,100)
  pn.Style=" -fx-background-color:red"
   pn.PrefWidth = 100
   pn.PrefHeight = 100
  MainForm.Show
End Sub
 
Top