jroriz Active Member Licensed User Longtime User Feb 26, 2021 #1 I'm trying to deal with a custom field, which has a string property with no default value. B4X: Copy #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: Copy 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?
I'm trying to deal with a custom field, which has a string property with no default value. B4X: Copy #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: Copy 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 Feb 27, 2021 #2 Props is a Map so you can use the GetDefault method. This is not related to the Default value of the property. B4X: Copy If Props.GetDefault("Campo","") <> "" Then End If Last edited: Feb 27, 2021 Upvote 0
Props is a Map so you can use the GetDefault method. This is not related to the Default value of the property. B4X: Copy If Props.GetDefault("Campo","") <> "" Then End If
jroriz Active Member Licensed User Longtime User Feb 27, 2021 #3 stevel05 said: Props is a Map so you can use the GetDefault method. This is not related to the Default value of the property. B4X: Copy If Props.GetDefault("Campo","") <> "" Then End If Click to expand... ? - shame on me! Upvote 0
stevel05 said: Props is a Map so you can use the GetDefault method. This is not related to the Default value of the property. B4X: Copy If Props.GetDefault("Campo","") <> "" Then End If Click to expand... ? - shame on me!