B4J Question [SOLVED] String DesignerProperty with no default value

jroriz

Active Member
Licensed User
Longtime User
I'm trying to deal with a custom field, which has a string property with no default value.

B4X:
#DesignerProperty: Key: Campo, DisplayName: Campo, FieldType: String, DefaultValue:

In the DesignerCreateView sub I need to know if this property has been filled.

Log(Props.Get("Campo") <> "") results in runtime error.

I found a way, but I found it a bit weird ...

B4X:
Public Sub DesignerCreateView (Base As Pane, Lbl As Label, Props As Map)
    
    'If Log(Props.Get("Campo") <> "") Then    ' runtime error

    If (Props.Get("Campo") = Null) = False Then    ' That's the way i found...
        ...
    End If

End Sub


Would anyone have a better suggestion?
 

stevel05

Expert
Licensed User
Longtime User
Props is a Map so you can use the GetDefault method. This is not related to the Default value of the property.

B4X:
If Props.GetDefault("Campo","") <> "" Then

End If
 
Last edited:
Upvote 0
Top