Italian [SOLVED] [B4J] B4XTable InlineEditing e B4XCalendarPicker della SDXUI_View

Elric

Well-Known Member
Licensed User
Ciao,

sto giocando con le B4XTable e l'inlineediting.

Con soddisfazione sono riusciuto a inserire il DataPicker.

Non riesco a inserire il B4XCalendarPicker della jSDXUI_View di @Star-Dust perché in fase di compilazione mi dà questo errore:
B4X:
B4J Version: 8.90
Parsing code.    (0.10s)
    Java Version: 8
Building folders structure.    (0.03s)
Compiling code.    (0.19s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
Compiling generated Java code.    Error
B4J line: 87
iv.Initialize(Null, \
javac 1.8.0_191
src\b4j\example\xuiviewsutils.java:138: error: method _initialize in class b4ximageview cannot be applied to given types;
_iv._initialize(ba,anywheresoftware.b4a.keywords.Common.Null,"");
   ^
  required: b4ximageview,BA,Object,String
  found: BA,Object,String
  reason: actual and formal argument lists differ in length

Cosa sbaglio?
 

Attachments

  • B4XTable-InlineEditing+B4XCalendarPicker 001.zip
    6.5 KB · Views: 148

Star-Dust

Expert
Licensed User
Longtime User
aggiorna la libreria SD_XUIVIEW. C'è un conflitto di nomi fra classi.
l'errore è su B4XImageView
 

Elric

Well-Known Member
Licensed User
Fatto! Così si compila!

Però, forse non è l'oggetto giusto con cui lavorare per un inline editing della B4XTable.

Così, mi dà errore alla riga 44 (ossia al comando "B4XCalendarPicker1.RemoveViewFromParent")
B4X:
Waiting for debugger to connect...
Program started.
Error occurred on line: 44 (Main)
java.lang.RuntimeException: Object should first be initialized (B4XView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getNodeObject(B4XViewWrapper.java:120)
    at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:116)
    at anywheresoftware.b4a.objects.B4XViewWrapper.RemoveViewFromParent(B4XViewWrapper.java:265)
    at b4j.example.b4xcalendarpicker._removeviewfromparent(b4xcalendarpicker.java:979)
    at b4j.example.main._appstart(main.java:111)
    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)

Se provo a rimuovere la stringa 44 un errore persiste:
B4X:
Waiting for debugger to connect...
Program started.
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (B4XView).
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:121)
    at anywheresoftware.b4j.objects.NodeWrapper$2.handle(NodeWrapper.java:1)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    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)
Caused by: java.lang.RuntimeException: Object should first be initialized (B4XView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getNodeObject(B4XViewWrapper.java:120)
    at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:116)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getHeight(B4XViewWrapper.java:196)
    at b4j.example.b4xcalendarpicker$ResumableSub_Show.resume(b4xcalendarpicker.java:1206)
    at b4j.example.b4xcalendarpicker._show(b4xcalendarpicker.java:1166)
    at b4j.example.b4xcalendarpicker._panelexternal_mousepressed(b4xcalendarpicker.java:874)
    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)
    ... 31 more
Error occurred on line: 101 (Main)
java.lang.RuntimeException: Object should first be initialized (B4XView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
    at b4j.example.b4xcalendarpicker._getbase(b4xcalendarpicker.java:487)
    at b4j.example.main._ie_entereditmode(main.java:226)
    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.GeneratedMethodAccessor3.invoke(Unknown Source)
    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.keywords.Common.CallSub4(Common.java:487)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:442)
    at b4j.example.inlineediting._makecelleditable(inlineediting.java:214)
    at b4j.example.inlineediting._cellclicked(inlineediting.java:93)
    at b4j.example.main._b4xtable1_cellclicked(main.java:163)
    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.GeneratedMethodAccessor3.invoke(Unknown Source)
    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.keywords.Common.CallSub4(Common.java:487)
    at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:450)
    at b4j.example.b4xtable$ResumableSub_CellClicked.resume(b4xtable.java:1498)
    at b4j.example.b4xtable._cellclicked(b4xtable.java:1239)
    at b4j.example.b4xtable._cell_mouseclicked(b4xtable.java:1229)
    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.GeneratedMethodAccessor3.invoke(Unknown Source)
    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 anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:110)
    at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
    at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    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)
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
    ' ************ B4XCalendarPicker *************
    B4XCalendarPicker1.Initialize(Me, "calpick")
    B4XCalendarPicker1.RemoveViewFromParent
    ' ************ /B4XCalendarPicker ************

A parte che non so se la sola inizializzazione sia sufficiente a creare quella view (non credo proprio ed è per questo che ti dà errore di oggetto non inizializzato) ma perché poi lo rimuovi immediatamente?
 

Elric

Well-Known Member
Licensed User
B4X:
    ' ************ B4XCalendarPicker *************
    B4XCalendarPicker1.Initialize(Me, "calpick")
    B4XCalendarPicker1.RemoveViewFromParent
    ' ************ /B4XCalendarPicker ************

A parte che non so se la sola inizializzazione sia sufficiente a creare quella view (non credo proprio ed è per questo che ti dà errore di oggetto non inizializzato) ma perché poi lo rimuovi immediatamente?
Sono partito dall'esempio di Erel https://www.b4x.com/android/forum/t...b4xtable-with-inline-editing-features.112686/ ed è costruito inserendo i controlli di editing della B4XTable in un layout a parte, che viene caricato subito dopo il layout principale.

Ritengo che in questo modo non devi creare i controlli a run-time ma ti basta richiamarli per singola cella nella sub IE_EnterEditMode.

Mi sono limitato a copiare il metodo e a provare ad adattarlo.

Sul fatto che non basta inizializzarla... sono qui a chiedere lumi!
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
    ' ************ B4XCalendarPicker *************
    B4XCalendarPicker1.Initialize(Me, "calpick")
    B4XCalendarPicker1.RemoveViewFromParent
    ' ************ /B4XCalendarPicker ************

A parte che non so se la sola inizializzazione sia sufficiente a creare quella view (non credo proprio ed è per questo che ti dà errore di oggetto non inizializzato) ma perché poi lo rimuovi immediatamente?
Capito. Le view da utilizzare per l'editing stanno nel layout Controls, compresa la B4XCalendarPicker1. Quindi il problema è che lo inizializzi! E' sufficiente eliminare quella riga:
B4X:
    ' ************ B4XCalendarPicker *************
''    B4XCalendarPicker1.Initialize(Me, "calpick")
    B4XCalendarPicker1.RemoveViewFromParent
    ' ************ /B4XCalendarPicker ************
 

Elric

Well-Known Member
Licensed User
Capito. Le view da utilizzare per l'editing stanno nel layout Controls, compresa la B4XCalendarPicker1. Quindi il problema è che lo inizializzi! E' sufficiente eliminare quella riga:
B4X:
    ' ************ B4XCalendarPicker *************
''    B4XCalendarPicker1.Initialize(Me, "calpick")
    B4XCalendarPicker1.RemoveViewFromParent
    ' ************ /B4XCalendarPicker ************
Infatti.

Risolto!

Grazie!

La inizializzavo perché, nelle varie prove, me lo suggeriva nella finestra dei logs. Quindi se i controlli sono creati nel design non è necessario inizializzarli, mentre se li creo a run-time si?

Gran bella view comunque: magari poco adatta per l'inline editing di una B4XTable ma gran bella view!
 
Top