B4A Library [B4X] XUI Views - Cross platform views and dialogs

Status
Not open for further replies.

Tayfur

Well-Known Member
Licensed User
How can i add manuelly?
B4X:
Sub Process_Globals
    Private MainForm As Form
    Private Dialog As B4XDialog
    Private XUI As XUI
    Private Base As B4XView
    Private APBar As AnotherProgressBar
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
   
    APBar.Initialize(MainForm,"APBar")
    MainForm.RootPane.AddNode(APBar.mLbl,100,100,500,100)
Waiting for debugger to connect...
Program started.
Satırda hata oluştu: 32 (Main)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
at b4j.example.main._appstart(main.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.start(main.java:38)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
 

Tayfur

Well-Known Member
Licensed User
Custom views must be added with the designer. You can create a layout file with a single custom view and load it whenever you want to add a new custom view.
B4X:
MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
   
    pn.Initialize("")
    pn.LoadLayout("L2") ' it has only customview // Private APBar As AnotherProgressBar
    MainForm.RootPane.AddNode(pn,50,00,300,100)
I added like code.
But I cant control height value?
Whats the correct code/way?
 

Tayfur

Well-Known Member
Licensed User
B4X:
    Dim p As Pane
    p.Initialize("")
    p.SetLayoutAnimated(0,0,0,640,480) ' Set layout so that it is known when using LoadLayout
    p.LoadLayout("L2")
    MainForm.RootPane.AddNode(p,0,0,640,480)
Thanks @DonManfred
I notted ".SetLayoutAnimated(0,0,0,400,100) "
 

Erel

Administrator
Staff member
Licensed User
V1.67 - Tag field added to the custom views. You can set it with the designer or at runtime.
- B4XDialog - New fields: TitleBarTextColor, TitleBarFont and ButtonsFont. See the signature dialog for an example (the buttons font is set to FontAwesome):



- B4XDialog - All text fields of B4XDialog accept CSBuilder objects as well as strings (B4A and B4i).
- AnotherProgressBar is no longer limited to indeterminate state. You can modify the Value field to change its position. Note that the change is animated.
Click on the Animated Counter button in the example to see it.
 

Erel

Administrator
Staff member
Licensed User
V1.70 - New B4XTimedTemplate. This template wraps other templates and creates an auto-closing dialog:



See the "options / select animal" dialog for an example. It is very simple to use.
- AnotherProgressBar - The change speed can be set with ValueChangePerSecond field. This allows using the progress bar as a visual timer. For example to show 5 seconds progress:
B4X:
AnotherProgressBar1.ValueChangePerSecond = 100 / 5
AnotherProgressBar1.SetValueNoAnimation(0) 'set the value immediately.
AnotherProgressBar1.Value = 100 'animate to 100. It will take 5 seconds.
 
Status
Not open for further replies.
Top