Alexander Stolte Expert Licensed User Longtime User Apr 12, 2020 #1 Hello, i have a simple layout, a label with anchors in both directions I load this layout to a panel. Then i change the panel height per code, but the label is not resizing. This is the code to get the panel: B4X: Copy Public Sub BodyPanel As B4XView Return xpnl_card_body End Sub and with this code i load the layout to the panel: B4X: Copy asdbc_main.BodyPanel.LoadLayout("frm_body") What am I doing wrong? Greetings
Hello, i have a simple layout, a label with anchors in both directions I load this layout to a panel. Then i change the panel height per code, but the label is not resizing. This is the code to get the panel: B4X: Copy Public Sub BodyPanel As B4XView Return xpnl_card_body End Sub and with this code i load the layout to the panel: B4X: Copy asdbc_main.BodyPanel.LoadLayout("frm_body") What am I doing wrong? Greetings
Erel B4X founder Staff member Licensed User Longtime User Apr 12, 2020 #2 The anchors and designer script are only applied once when the layout is loaded (in B4J and B4i it is different). Alexander Stolte said: asdbc_main.BodyPanel.LoadLayout("frm_body") Click to expand... This code is wrong and hints that your component design is also wrong. The layout should be loaded from inside the class. Otherwise the events will not be handled in the class. Best way is to implement it as a XUI custom view. Upvote 0
The anchors and designer script are only applied once when the layout is loaded (in B4J and B4i it is different). Alexander Stolte said: asdbc_main.BodyPanel.LoadLayout("frm_body") Click to expand... This code is wrong and hints that your component design is also wrong. The layout should be loaded from inside the class. Otherwise the events will not be handled in the class. Best way is to implement it as a XUI custom view.
Alexander Stolte Expert Licensed User Longtime User Apr 12, 2020 #3 Erel said: Best way is to implement it as a XUI custom view. Click to expand... This is a XUI CustomView, but i want to give the user the option to load a layout, like in your B4XDrawer view. Upvote 0
Erel said: Best way is to implement it as a XUI custom view. Click to expand... This is a XUI CustomView, but i want to give the user the option to load a layout, like in your B4XDrawer view.
Erel B4X founder Staff member Licensed User Longtime User Apr 12, 2020 #4 I see. The container must be resized before the layout is loaded. Upvote 0
Alexander Stolte Expert Licensed User Longtime User Apr 12, 2020 #5 thats a problem, because i have 2 sizes: Half Expanded and Full Expanded. Maybe i should to force the user to load 2 layouts for the 2 heights, the layout can be the same, but the height is different. Upvote 0
thats a problem, because i have 2 sizes: Half Expanded and Full Expanded. Maybe i should to force the user to load 2 layouts for the 2 heights, the layout can be the same, but the height is different.
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2020 #6 You just need to make sure that the panel is sized correctly before the layout is loaded. Upvote 0
Alexander Stolte Expert Licensed User Longtime User Apr 13, 2020 #7 Erel said: You just need to make sure that the panel is sized correctly before the layout is loaded. Click to expand... That's not the problem, my problem is this: Half expanded and full expanded The first mode is half, the layout is resized for the half size, if the user drag it to top, then the layout height must be bigger Upvote 0
Erel said: You just need to make sure that the panel is sized correctly before the layout is loaded. Click to expand... That's not the problem, my problem is this: Half expanded and full expanded The first mode is half, the layout is resized for the half size, if the user drag it to top, then the layout height must be bigger
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2020 #8 Two layout are probably the best option here. Upvote 0