B4J Question Expanded an Accordion by default

codie01

Active Member
Licensed User
Longtime User
Hi All,

I have set JavaFX scene layout with some accordions, my question is does anyone know how to set a one "Expanded" when the form is called.

I have set "Expanded" for one in scene builder but is not expanded when the layout is called.

Regards Phil
 

jmon

Well-Known Member
Licensed User
Longtime User
yes with Javaobject:
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private acc1 As Node
    Private acc2 As Node
    Private acc3 As Node
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("Main") 'Load the layout file.
    MainForm.Show
   
    Dim acc2Jo As JavaObject = acc2
    acc2Jo.RunMethod("setExpanded", Array(True))
   
End Sub
 
Upvote 0

codie01

Active Member
Licensed User
Longtime User
Thanks jmon,

your response and code works well, my problem is that I am using showandwait, which is where my problem is. it does not work.

kind regards phil
 
Upvote 0

codie01

Active Member
Licensed User
Longtime User
Good Day jmon,

I get the following error when the using showandwait. java.lang.RuntimeException: Object should first be initialized (Node).

Here is the code section:

B4X:
   MainCustomerForm.Initialize("CustomerForm", 790, 490)
   MainCustomerForm.RootPane.LoadLayout("QualasCustomer") 'Load the layout file.
   MainCustomerForm.Title = "Qualas"
   MainCustomerForm.SetOwner(MainForm)
   MainCustomerForm.Resizable = False
   MainCustomerForm.SetFormStyle("UNIFIED")
   Dim acc2Jo As JavaObject = stkAccordion
   acc2Jo.RunMethod("setExpanded", Array(True))
   MainCustomerForm.Title = "CUSTOMER CARD: " & q_recordidF.text & " " & q_colastF.text
   MainCustomerForm.ShowAndWait

Thanks.
 
Upvote 0
Top