Bug? Handle Resize Event ??

ilan

Expert
Licensed User
Longtime User
I am not sure if it is a bug or not but if the "Handle Resize Event" checkbox is checked in the deigner Layout file and I try to perform some animations it seems like it's not working. using sleep() will sometimes help. if I uncheck the "Handle Resize Event" checkbox it works fine.

I am not sure if it is related to the latest b4j version but I just ran into this problem and it took me a while to find the solution for my problem. if it should work like this then a warning in the logs upper windows (in yellow maybe) would be nice so if I am changing position in Appstart or using Setlayoutanimation() then a warning could help save a lot of time.
I am also not sure if it is only on Appstart or also later when the app is running. I encounter it on Appstart.

(example attached.)

thanx, ilan
 

Attachments

  • test1.zip
    2.1 KB · Views: 155

Erel

B4X founder
Staff member
Licensed User
Longtime User
No bug here.

The meaning of "handle resize event" is that the layout anchors and designer script are reapplied when the container is resized. This can happen any number of times.
Best solution is to do whatever you can in the layout file itself.
Otherwise, you either need to disable this feature or set the layout however you like in the Resize event:
B4X:
Private Sub MainForm_Resize (Width As Double, Height As Double)
    animatePanels
End Sub

Tip: You should never see Pane and Node in your code. Use B4XView.
 

ilan

Expert
Licensed User
Longtime User
ok, thanks for clarifying.

Tip: You should never see Pane and Node in your code. Use B4XView.

i try to use as many b4xviews as i can but it is not always possible.

as far as i know if i want to create a panel on the fly and would like it to be xui ready, i have to do it like this:

B4X:
    Dim p As Pane
    p.Initialize("")
    Dim pnl As B4XView = p

so i have to create the node (b4j) or view (b4a/b4i) and then i create a b4xview and set it to that node.
it would be great if something like this would be possible:

B4X:
    Dim pnl As B4XView 'Panel
    pnl.Initialize.asPanel("")
    
    Dim imgv As B4XView 'Imageview
    imgv.Initialize.asImageView("")

or like this:

B4X:
    Dim pnl As B4XPanel  'Panel
    pnl.Initialize("")   
    
    Dim imgv As B4xImageView  'Imageview
    imgv.Initialize("")
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
as far as i know if i want to create a panel on the fly and would like it to be xui ready, i have to do it like this:
B4X:
Dim panel As B4XView = xui.CreatePanel("")

B4XImageView is not the same as ImageView.
You can use XUIViewsUtils.CreateLabel or CreateB4XImageView to create those common views.
 
Top