B Big JR Member Licensed User Longtime User Dec 11, 2013 #1 How do I programatically add a button to a scrollpane rather than to the rootpane? I've dragged a scrollpane onto the layout, given it an id of sp1. I can use addnode to add a button to the main anchorpane but don't know how add a node to the scrollpane instead.
How do I programatically add a button to a scrollpane rather than to the rootpane? I've dragged a scrollpane onto the layout, given it an id of sp1. I can use addnode to add a button to the main anchorpane but don't know how add a node to the scrollpane instead.
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2013 #2 You should just call ScrollPane1.AddNode(...) You will need to change the variable type to Pane as ScrollPane will not be recognized. Upvote 0
You should just call ScrollPane1.AddNode(...) You will need to change the variable type to Pane as ScrollPane will not be recognized.
B Big JR Member Licensed User Longtime User Dec 11, 2013 #3 Erel said: You should just call ScrollPane1.AddNode(...) You will need to change the variable type to Pane as ScrollPane will not be recognized. Click to expand... I'm getting errors. In process globals I have: Dim Scrollpane1 As Pane In the action for a button outside the scrollpane I have: Dim ThisBtn As Button ThisBtn.Initialize("ThisBtn") ThisBtn.Tag = "2" ThisBtn.Text = "Play #1" Scrollpane1.AddNode(ThisBtn, 10, 10, 60, 40) Upvote 0
Erel said: You should just call ScrollPane1.AddNode(...) You will need to change the variable type to Pane as ScrollPane will not be recognized. Click to expand... I'm getting errors. In process globals I have: Dim Scrollpane1 As Pane In the action for a button outside the scrollpane I have: Dim ThisBtn As Button ThisBtn.Initialize("ThisBtn") ThisBtn.Tag = "2" ThisBtn.Text = "Play #1" Scrollpane1.AddNode(ThisBtn, 10, 10, 60, 40)
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2013 #4 Can you upload your project (File - Export as zip)? Upvote 0
B Big JR Member Licensed User Longtime User Dec 11, 2013 #5 Erel said: Can you upload your project (File - Export as zip)? Click to expand... Hi Erel, Project zip is attached. Attachments Test_JR.zip Test_JR.zip 1.1 KB · Views: 547 Upvote 0
Erel said: Can you upload your project (File - Export as zip)? Click to expand... Hi Erel, Project zip is attached.
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2013 #6 Thank you. For now it is not possible to use ScrollPane. It will be supported in the next update. Note that the items should be added to the internal AnchorPane (though it will not work). You can consider using ListView instead. See this tutorial: Customized ListView Upvote 0
Thank you. For now it is not possible to use ScrollPane. It will be supported in the next update. Note that the items should be added to the internal AnchorPane (though it will not work). You can consider using ListView instead. See this tutorial: Customized ListView
M mikeeepe Member Licensed User Longtime User Dec 14, 2014 #7 What version will be able to add to the internal AnchorPane of a ScrollPane? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2014 #8 This is an old thread. ScrollPane is already supported. Upvote 0
M mikeeepe Member Licensed User Longtime User Dec 15, 2014 #9 I am trying to add controls to a scrollpane, but there doesn't seem to be an option to add to the innernode. See attached program. I want to add the time spinners to the scroll pane. Any ideas? Attachments WhiteSheet.zip WhiteSheet.zip 60.9 KB · Views: 492 Upvote 0
I am trying to add controls to a scrollpane, but there doesn't seem to be an option to add to the innernode. See attached program. I want to add the time spinners to the scroll pane. Any ideas?
Erel B4X founder Staff member Licensed User Longtime User Dec 15, 2014 #10 See my answer here: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#content Upvote 0
See my answer here: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#content
ilan Expert Licensed User Longtime User Aug 14, 2015 #12 Erel said: See my answer here: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#content Click to expand... sorry erel but your answer there is not clear enough (at least for me). i have created in designer a pane and i would like to add it to the scrollpane but i get an error. Code: Copy Dim p As Pane p.Initialize("") p = leftscrollp.InnerNode p.AddNode(menupnl,0,0,leftscrollp.Width,leftscrollp.Height) Program started. Error occurred on line: 22 (main). java.lang.RuntimeException: Object should first be initialized (Node). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32) at b4j.example.main._appstart(main.java:91) 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:497) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) 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:497) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.start(main.java:36) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863) at com.sun.javafx.application.LauncherImpl$$Lambda$53/2114892413.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl$$Lambda$46/237061348.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295) at com.sun.javafx.application.PlatformImpl$$Lambda$48/1704355536.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294) at com.sun.javafx.application.PlatformImpl$$Lambda$47/1030870354.run(Unknown Source) 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$145(WinApplication.java:101) at com.sun.glass.ui.win.WinApplication$$Lambda$36/1232367853.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) Click to expand... what am i doing wrong? Upvote 0
Erel said: See my answer here: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#content Click to expand... sorry erel but your answer there is not clear enough (at least for me). i have created in designer a pane and i would like to add it to the scrollpane but i get an error. Code: Copy Dim p As Pane p.Initialize("") p = leftscrollp.InnerNode p.AddNode(menupnl,0,0,leftscrollp.Width,leftscrollp.Height) Program started. Error occurred on line: 22 (main). java.lang.RuntimeException: Object should first be initialized (Node). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32) at b4j.example.main._appstart(main.java:91) 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:497) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156) 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:497) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82) at anywheresoftware.b4a.BA.raiseEvent(BA.java:84) at b4j.example.main.start(main.java:36) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863) at com.sun.javafx.application.LauncherImpl$$Lambda$53/2114892413.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl$$Lambda$46/237061348.run(Unknown Source) at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295) at com.sun.javafx.application.PlatformImpl$$Lambda$48/1704355536.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294) at com.sun.javafx.application.PlatformImpl$$Lambda$47/1030870354.run(Unknown Source) 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$145(WinApplication.java:101) at com.sun.glass.ui.win.WinApplication$$Lambda$36/1232367853.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) Click to expand... what am i doing wrong?
BeneBarros Active Member Licensed User Longtime User Aug 14, 2015 #13 ilan said: sorry erel but your answer there is not clear enough (at least for me). i have created in designer a pane and i would like to add it to the scrollpane but i get an error. Code: Copy Dim p As Pane p.Initialize("") p = leftscrollp.InnerNode p.AddNode(menupnl,0,0,leftscrollp.Width,leftscrollp.Height) what am i doing wrong? Click to expand... menupn1.initialize("") Upvote 0
ilan said: sorry erel but your answer there is not clear enough (at least for me). i have created in designer a pane and i would like to add it to the scrollpane but i get an error. Code: Copy Dim p As Pane p.Initialize("") p = leftscrollp.InnerNode p.AddNode(menupnl,0,0,leftscrollp.Width,leftscrollp.Height) what am i doing wrong? Click to expand... menupn1.initialize("")
ilan Expert Licensed User Longtime User Aug 14, 2015 #14 BeneBarros said: menupn1.initialize("") Click to expand... menupnl is created in designer so no need to intialize it, thank you anyway... Upvote 0
BeneBarros said: menupn1.initialize("") Click to expand... menupnl is created in designer so no need to intialize it, thank you anyway...
ilan Expert Licensed User Longtime User Aug 14, 2015 #15 such a simple think but cannot find anywhere in the forum a solution... just want to add a complete pane to the scrollpane and scroll vertical... Upvote 0
such a simple think but cannot find anywhere in the forum a solution... just want to add a complete pane to the scrollpane and scroll vertical...
ilan Expert Licensed User Longtime User Aug 14, 2015 #16 ok i solved it in a different way, just created a layout with only that pane and i am loading the layout to the scrollpane, but still i would like to know how i can make it without creating a new layout... Upvote 0
ok i solved it in a different way, just created a layout with only that pane and i am loading the layout to the scrollpane, but still i would like to know how i can make it without creating a new layout...
Erel B4X founder Staff member Licensed User Longtime User Aug 16, 2015 #17 See this thread: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#post-358182 Upvote 0
See this thread: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#post-358182
ilan Expert Licensed User Longtime User Aug 16, 2015 #18 Erel said: See this thread: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#post-358182 Click to expand... I did, but i could not load the pane to the scrollpane... I too get the error that my onernode is not intialize, and i am creating it in designer. Then if i intialize the scrollpane i dont get the error but no pane is loaded... Upvote 0
Erel said: See this thread: https://www.b4x.com/android/forum/threads/adding-a-label-to-a-scrollpane.44436/#post-358182 Click to expand... I did, but i could not load the pane to the scrollpane... I too get the error that my onernode is not intialize, and i am creating it in designer. Then if i intialize the scrollpane i dont get the error but no pane is loaded...
Erel B4X founder Staff member Licensed User Longtime User Aug 16, 2015 #19 The code you posted is wrong. You initialize a pane and then you set the non-existent pane from ScrollPane.InnerNode to the same variable. You should instead set InnerNode: Code: Copy ScrollPane.InnerNode = Pane Upvote 0
The code you posted is wrong. You initialize a pane and then you set the non-existent pane from ScrollPane.InnerNode to the same variable. You should instead set InnerNode: Code: Copy ScrollPane.InnerNode = Pane
ilan Expert Licensed User Longtime User Aug 16, 2015 #20 Sorry but you wrote in the link you posted to do it like this.. maybe i understood it wrong Ok i will try, thank you erel Last edited: Aug 16, 2015 Upvote 0
Sorry but you wrote in the link you posted to do it like this.. maybe i understood it wrong Ok i will try, thank you erel