Sometimes I have to change a custom property value of a custom control by code from the controls parent. This is quite easy. But if I do so only the value of the property is changed.
I like to have a property listener that triggers a sub if the custom property value changes like an event does.
Is that possible in B4A and if yes hoiw. Thank you.
Are you speaking of customviews you have developed or in general.
If they are yours you can define property routines with getProperty and setProperty and put any code in theses routines.
If they are not yours, the only chance is that the developer of these customviews includes the property routines.
Hello,
thank you for the response. 1st I'm talking about my own controls. Maybe that my question was not well. Lets ask me in general. I need a way to infor my code if the value of a variable/global has changed. For Example: in the control I have the global or property 'color'. If I change the property by setting it's value form the parent code I like to react on this change inside the controls code. Thats why I looking for a listener that goes activ and calls a sub like an event does if triggert.
You can add properties to you cutomviews, like below.
B4X:
Public Sub setGraphColor(GraphColor As Int)
Graph.GraphColor = GraphColor
DrawGraph
End Sub
'Gets or sets the graph grid color
Public Sub getGridColor As Int
Return Graph.GraphColor
End Sub
And use them outsides:
B4X:
xGraph1.GridColor = xui.Color_Gray
The two prefixes must be lower case !
'set' means writable and 'get' means readable.
Oh yes! this is what is also in my mind. But in the past I worked with .Net and I was able to create a listener for this. Seems to me that there is non in B4A. Thank you for your answers.
Oh yes! this is what is also in my mind. But in the past I worked with .Net and I was able to create a listener for this. Seems to me that there is non in B4A. Thank you for your answers.
Observables are primitive types (boolean, byte, double, float, integer, long, short), strings, objects or collections (map, list, record) that trigger events when they are modified. They can also automatically update the views with which they are bound. Example 1: You have associated an...
Hi, now I examined the Demo Project of Observarables. Wow, that is exactly I am looking for. Makes live of developing database driven apps much easier. Helps me to develop my new data bound custom controls. Thank you very much. ???