Android Question Study : How to code the custom view

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
I have problem about creating the custom view. I've tried to add some code in the expert's code for learning
,but I can't make it completely.

B4X:
'Study
#DesignerProperty: Key: Enabled, DisplayName: Enabled,FieldType: Boolean,DefaultValue:True,Description: Enabled the progressBar
#DesignerProperty: Key: Visibled, DisplayName:Visibled,FieldType: Boolean,DefaultValue:True,Description: Visibled the progressBar
B4X:
Public Sub SetEnabled(myenabled As Boolean)  'Theera's code for study
    Enabled =myenabled
    mBase.Enabled=Enabled
End Sub

Public Sub SetVisibled(myvisibled As Boolean) 'Theera's code for study
    Visibled=myvisibled
    mBase.Visibled=Visibled
End Sub
 
Solution
B4X:
    Private m_Enabled As Boolean = True
    Private m_Visible As Boolean = True
B4X:
Public Sub setEnabled(Enabled As Boolean)  'Theera's code for study
    m_Enabled = Enabled
    mBase.Enabled=Enabled
End Sub

Public Sub setVisible(Visible As Boolean) 'Theera's code for study
    m_Visible = Visible
    mBase.Visible=Visible
End Sub

B4X:
    sel.Enabled = False
    sel.Visible = False

Cableguy

Expert
Licensed User
Longtime User
the properties enable and visible are booleans, so the expect either True or False
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
the properties enable and visible are booleans, so the expect either True or False
the lastest, the compiler told me. I never declare enabled and visibled,there are not members . I think I'm lost myself how to code these properties.
I tried to copy the same code,how to do,but it isn't worked.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
B4X:
    Private m_Enabled As Boolean = True
    Private m_Visible As Boolean = True
B4X:
Public Sub setEnabled(Enabled As Boolean)  'Theera's code for study
    m_Enabled = Enabled
    mBase.Enabled=Enabled
End Sub

Public Sub setVisible(Visible As Boolean) 'Theera's code for study
    m_Visible = Visible
    mBase.Visible=Visible
End Sub

B4X:
    sel.Enabled = False
    sel.Visible = False
 
Upvote 0
Solution

Theera

Well-Known Member
Licensed User
Longtime User
I think this code has something be wrong.
B4X:
'Study
#DesignerProperty: Key: Enabled, DisplayName: Enabled,FieldType: Boolean,DefaultValue:True,Description: Enabled the progressBar
#DesignerProperty: Key: Visible, DisplayName:Visible,FieldType: Boolean,DefaultValue:True,Description: Visible the progressBar
 
Last edited:
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I think this code has something be wrong.
No, you just don't know how to call them up correctly. Go to the DesignerCreateView sub and do this:
B4X:
    m_Enabled = Props.GetDefault("Enabled",True)
    m_Visible = Props.GetDefault("Visible ",True)

But I recommend that you read the booklet, everything is explained there.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
After to compile b4xlib file. It's error message.
Undeclared variable 'enabled' is used before it was assigned any value.
How do I do? ,Sir
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Due to the AmirMK82's b4xlib, I have to ask him permit me before, Could I send you privately?
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
if it is a paid library or the license is restricted, you should not send it to me privately. Ask the developer of the original library for help.
Thank you for guiding to me.I try be careful.
 
Upvote 0
Top