Alexander Stolte Expert Licensed User Longtime User Nov 8, 2018 #1 Hello, i have a problem, i want to set a "LoadLayout" property for my new view. I have this code: B4X: 'set the layout for designer Public Sub setLoadLayout(layout As LayoutValues) mypnl.LoadLayout(layout.toString) End Sub The IDE Log says: B4X: Property: _loadlayout is writeonly. How can i solve this, so the user can call myview.loadlayout("") and then he have the selection of the forms?
Hello, i have a problem, i want to set a "LoadLayout" property for my new view. I have this code: B4X: 'set the layout for designer Public Sub setLoadLayout(layout As LayoutValues) mypnl.LoadLayout(layout.toString) End Sub The IDE Log says: B4X: Property: _loadlayout is writeonly. How can i solve this, so the user can call myview.loadlayout("") and then he have the selection of the forms?
Alexander Stolte Expert Licensed User Longtime User Nov 8, 2018 #2 ahh, this may not be a property, it must be a function Upvote 0
klaus Expert Licensed User Longtime User Nov 8, 2018 #3 This is a write only property, because of the 'set' prefix. B4X: Public Sub setLoadLayout(LayoutName As String) mypnl.LoadLayout(LayoutName) End Sub This is a method: B4X: Public Sub LoadLayout(LayoutName As String) mypnl.LoadLayout(LayoutName) End Sub In this example, both do the same, but to me it's more logical to use a method. Why do you want to use LayoutValues? mypnl.LoadLayout expects the layout name as a string. Upvote 0
This is a write only property, because of the 'set' prefix. B4X: Public Sub setLoadLayout(LayoutName As String) mypnl.LoadLayout(LayoutName) End Sub This is a method: B4X: Public Sub LoadLayout(LayoutName As String) mypnl.LoadLayout(LayoutName) End Sub In this example, both do the same, but to me it's more logical to use a method. Why do you want to use LayoutValues? mypnl.LoadLayout expects the layout name as a string.