B4J Question Editable B4XTable in TabPane - How To Do It? - SOLVED

markm

Member
Licensed User
Longtime User
EDIT: I got it fixed. Typing this up and walking away for a minute helped me put fresh eyes on it. I tested by changing the example to do exactly what I wanted and it worked. So I went back and found a stray SELECT/CASE I'd missed modifying for my table layout. So the code as I posted below can be used for putting an editable B4XTable on a pane in a tabpane.


I finally decided to take the plunge and update to the latest versions of B4A and B4J to take advantage of all the cross-platform fun. First off, I'm really liking the new features but am struggling a bit with some learning (bad/lazy habits I'd gotten into that 'just worked' don't work now).

In the past when I needed editable tables, I just used the standard TableView, populated it with TextViews and did it that way. The B4XTable looks much nicer and simpler, plus when I need to port over to Android, it will be easier. The problem I'm having is, I have a TabPane with two tabs: "View/Add Single Item" and "View Table". I've put B4XTable1 on "View Table", copied all the Subs from the InlineEditableB4XTable example to my project and modified them to fit

B4X:
Process Globals
Private ViewAllPane As B4XView
Private xui As XUI
Private B4XPlusMinus1 As B4XPlusMinus
Private TextField1 As B4XView
Type FocusedCell (ColumnId As String, RowId As Long, View As B4XView, VisibleIndex As Int, PrevValue As Object, Tag As Object)
Private fc As FocusedCell
Private tableViewAll As B4XTable 'TableView
.
. 'other declarations trimmed for brevity'
.
ViewTable.LoadLayout("ViewAll", "View Table") 'loads ViewAll.BJL which has pane ViewAllPane'
ViewAllPane.LoadLayout("ViewTable") 'Loads ViewTable.BJL to ViewAllPane'
ViewAllPane.LoadLayout("Controls") 'Loads Controls.BJL (copied from example) to ViewAllPane'
B4XPlusMinus1.mBase.RemoveViewFromParent

When I try running it, I get an error in Sub SetEditableControlLayout --
Error occurred on line: 874 (Main)
java.lang.RuntimeException: Object should first be initialized (B4XView).


Line 874 is
B4X:
   If SelectedControl.View.Parent <> p Then

I can provide more info if needed but hope this is enough to get me pointed in the right direction. Thanks for all the hard work in providing this software for us!
 
Last edited:
Top