iOS Question ClvNested

Lucas Eduardo

Active Member
Licensed User
I have a code in B4A that i'm converting to B4I, so in B4A i'm using CLVNested, but in B4I it's not necessary.
I removed the CLVNested, but when e compile the app i get an error SignalHandler 11.

B4X:
    Dim p As B4XView = XUI.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
    p.LoadLayout("layout_orc_pedido_parte1")
    clvOrcamentoPedido.Add(p, "teste")
   
    Log("size clvOrcamentoPedido: "&clvOrcamentoPedido.Size)
   
    'EXTRA
    Dim p3 As B4XView = XUI.CreatePanel("")
    p3.SetLayoutAnimated(0, 0, 0, 100%x, 0.5%y)
    p3.LoadLayout("layout_orc_pedido_parte2")
'    p3.Tag = clvExtrasOrc 'must set the Panel tag like this  <--- this is for B4A CLVNested, not needed in B4I
    clvOrcamentoPedido.Add(p3, "nada")
   
    Log("size clvOrcamentoPedido3: "&clvOrcamentoPedido.Size)
    clvOrcamentoPedido.ResizeItem(1, clvExtrasOrc.AsView.Height)
the logs to know the clv size always return 0 and a don't know why, so the error that i mentioned "SignalHandler 11", it's in line
B4X:
clvOrcamentoPedido.ResizeItem(1, clvExtrasOrc.AsView.Height)
because probably the clv size it's 0.

That's the error log
B4X:
SignalHandler 11
Error occurred on line: 4116 (PrincipalCervejaria)
Signal - 11
Stack Trace: (
    "0   iBrew                SignalHandler + 120",
    "1   libsystem_platform.dylib            0x00000001ada14884 70F43BD5-061B-3579-8B83-69771FB61812 + 34948",
    "2   iBrew                -[b4i_customlistview _getpanel:] + 52",
    "3   iBrew                -[b4i_customlistview _resizeitem::] + 120",
    "4   CoreFoundation       1B9B1E61-8CB4-3903-9870-402C3DE959BB + 1252384",
    "5   CoreFoundation       1B9B1E61-8CB4-3903-9870-402C3DE959BB + 7472",
    "6   iBrew                +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608",
    "7   iBrew                -[B4IShell runVoidMethod] + 232",
    "8   iBrew                -[B4IShell raiseEventImpl:method:args::] + 1800",
    "9   iBrew                -[B4IShellBI raiseEvent:event:params:] + 1580"
)
Am i adding corretly in clv? There is another thing to do to work the CLVs nesting?
 

Lucas Eduardo

Active Member
Licensed User
When i was building the example project, i figure it out why i was getting that error.

So, i tested to add in my CLV the layouts that i want, in the example project the layouts are loaded correctly but in my real project it's looks like i did not set the width of the views. To get some effect in clv when i add my layout i have to set 500%y of heigth

Like this

B4X:
Dim p As B4XView = XUI.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 100%x, 500%y)
p.LoadLayout("layout_orc_pedido_parte1")
clvOrcamentoPedido.Add(p, "teste")

'EXTRA
Dim p3 As B4XView = XUI.CreatePanel("")
p3.SetLayoutAnimated(0, 0, 0, 100%x, 0.5%y)
p3.LoadLayout("layout_orc_pedido_parte2")
'    p3.Tag = clvExtrasOrc 'must set the Panel tag like this  <--- this is for B4A CLVNested, not needed in B4I
clvOrcamentoPedido.Add(p3, "nada")
  
Log("size clvOrcamentoPedido3: "&clvOrcamentoPedido.Size)
clvOrcamentoPedido.ResizeItem(1, clvExtrasOrc.AsView.Height)


Dim p4 As B4XView = XUI.CreatePanel("")
p4.SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
p4.LoadLayout("layout_orc_pedido_parte3")
p4.SetLayoutAnimated(0, 0, 0, 100%x, lblVoltarOrc.Top + lblVoltarOrc.Height + 3%y)
clvOrcamentoPedido.Add(p4, "nada")

I already unchecked in my layouts the handle resize event.

The result it's uploaded.
The pink color it's the height of CLV and the blue it's the panel
 

Attachments

Last edited:

Lucas Eduardo

Active Member
Licensed User
I finally could reproduce the error. Here it's the example project Example
I have more than one page and if i load a layout with more than one view in my first page that it's my page principal with NavigationController. The second page where i load my clv don't ajust correctly.

In the drawer width too, i have to set 200%x to have the size that i want.

Why this is happening?
 

Lucas Eduardo

Active Member
Licensed User
In the sub "ajusta_pos_views_status" i have all the code that change the views positions, so i moved to the Page_Resize event, but still don't working. I tryed to resize the clv item in the page_Resize event and the results does not changed.

I'm forgotting something else to get this working
 

Lucas Eduardo

Active Member
Licensed User
why this code did not work?
B4X:
Dim p4 As B4XView = xui.CreatePanel("")
p4.SetLayoutAnimated(0, MainPage.RootPanel.Left, MainPage.RootPanel.Top, MainPage.RootPanel.Width, 50%y)
p4.LoadLayout("layout_orc_pedido_parte3")
clvOrcamentoPedido.Add(p4,"")
and this code work?

B4X:
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, MainPage.RootPanel.Left, MainPage.RootPanel.Top, MainPage.RootPanel.Width, MainPage.RootPanel.Height)
p.LoadLayout("layout_orc_pedido_parte3")
clvOrcamentoPedido.Add(p, "")
To add some item in clv i can't use %y to set the heigth, that's correct?
To use the %y to set the item heigth have i do this in Page_Resize event?

In the example attached it's now working, but i'm confused if it's the correct way.
 

Attachments

Top