Android Question Notice enabled changed

Guenter Becker

Active Member
Licensed User
Hello and have a good day

I have to know by an event that is raised automatically if a view state changes from enabled to disabled and vice versa.
Do'nt know if to it is possible with an event or listener or else.

Can anyone please help me with a b4a code snipped to solve this? Thank you in advance.
 

John Naylor

Active Member
Licensed User
Longtime User
Which view(s) are you wanting to use this with? If it's XUI views you can modify the source code to create a new version. Add a DesignerProperty (myEnabled as boolean) and when that is changed have it execute a callsubdelayed event that you can deal with in your main code and an 'mbase.enabled =' to actually change the enabled state.

[Edit] actually no need for a new designer property you could simply add / modify


B4X:
Public Sub setEnabled (b As Boolean)
    mBase.enabled = b    'Deal with enabling / disabling the control
   
    If xui.SubExists(mCallBack, mEventName & "_EnabledStateChanged", 1) Then
        CallSubDelayed2(mCallBack, mEventName & "_EnableStateChanged", b)
    End If
End Sub

Could you elaborate further on what you need?
 
Last edited:
Upvote 0

Guenter Becker

Active Member
Licensed User
Thank you, I found a solution (Observable) I di'nt remember. Ist a classs taken from the forum.
 
Upvote 0
Top