Android Code Snippet [B4x] Easy dis-/enabling views (by condition)

If you need to dis-/enable views (e.g. buttons) depending on a condition you can do it by

B4X:
SetButtons(Not(UnameTF.Text=LoggedInUserName))
    
Sub SetButtons (enabled As Boolean)
    NewUserBTN.Enabled=enabled
    UpdateUserBTN.Enabled=enabled
    PWResetBTN.Enabled=enabled
End Sub

Here it's about: The logged in user may not change his/her own data (= buttons disabled). Via not the compare (will be true if it's the same user) will be negated by "NOT"
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…