Android Question The Enabled property of the B4XComboBox

Sergey_New

Well-Known Member
Licensed User
Longtime User
The Enabled property of the B4XComboBox element set in the constructor does not work.
The code does not work either:
cmb.cmbBox.Enabled = False
How to fix?
 

Sergey_New

Well-Known Member
Licensed User
Longtime User
klaus, doesn't work.
Also does not work:
B4X:
cmb.mBase.GetView(0).Enabled = False
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
cmb.cmbBox.Enabled = False
This definitely works, al least for me:
B4X:
B4XComboBox1.cmbBox.Enabled=False
Don't be stingy showing your code if you want help Sergey. The more you explain and show all pertinent code the fewer posts will be needed to solve.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
What platform are you using?
I tested it with B4J before posting and it works.
Now i tested B4A and it does not work, but cmb. cmbBox .Enabled = False works on my device in B4A.
The code below works for me, tested on all three platforms.:
B4X:
#If B4J
    cbxFirstName.mBase.Enabled = False
#Else If B4A
    cbxFirstName.cmbBox.Enabled = False
#Else
    cbxFirstName.mBtn.Enabled = False
#End If
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Checked on the device. No result.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I looked at your project and the Enabled property doesn't work in B4XDialogs.
I looked into the code of the B4XDialogs Class, and i found that the Enabled property is set to True, internally for all views in the Dialog.
Therefore you cannot change it in your code. Or you need to modify the B4XDialogs class code.
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Klaus, thanks!
I don't want to change the standard class at all. Maybe Erel will fix this in future releases?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Erel will fix this in future releases?
I looked at your project and the Enabled property doesn't work in B4XDialogs.
It works. This is how your code should be:
B4X:
Sub Button1_Click
    Dialog.Initialize (Activity)
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 50%x, 58dip)
    p.LoadLayout("WitnesDialog")
    cmb.cmbBox.Add("0")
    cmb.cmbBox.Add("1")
    Dialog.PutAtTop = False    
    Dim rs As ResumableSub = Dialog.ShowCustom(p, "OK", "", "CANCEL")
    cmb.cmbBox.Enabled = False
    Wait For (rs) Complete (Result As Int)
End Sub
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Mahares, yes your code works. Thanks!
 
Upvote 0

Similar Threads

Top