Android Question Custom Views - Props and "recognizability"

LucaMs

Expert
Licensed User
Longtime User
I state that I am currently not able to recreate the same situation.


When creating a Custom View I got from Props two values (two keys), TextColor and Color, not custom, not declared by me in code.

In the tutorial that Erel has indicated there is this sentence:

"The Props map holds the custom properties"

which makes think that only custom properties are received via the Map. But I am certain that I did not have hallucinations. Maybe I initially created those properties, then I removed them from the code but I have continued to receive them. This may depend on some compiled files? How to check?

Also, after some modifications, the Custom View type library created is not recognized as such by the environment (the Add View - Custom View menu is disabled), although it functions well as class.


However, I understand that I should try to recreate those situations and post the projects.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've created a new control and printed the map keys:

defaultcolor
activity
ba
eventName
customType
shortType
type
BackTextColor
csType

I don't see Color or TextColor here.

B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) 'ignore
   mBase = Base
   For Each k As String In Props.Keys
     Log(k)
   Next
   mBackTextColor = Props.Get("BackTextColor")
   mTextColor = Props.Get("TextColor")
   mColor = Props.Get("Color")
  
   CreateGUI
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I know, I also "investigated" many times, listing the keys of Props. Sometimes those keys are present, other times not.

If I create a new project, I do not get those keys.

I can only think to some "dirty" stuff, something remained from old code and previous executions. For this reason I sent you all files, also those already compiled.


Running that project I get:
upload_2017-3-27_9-9-41.png


you too?
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Why does it matter that these properties appear?
Because if those properties were the default, I mean not those defined in the source code but directly from the IDE, it would be a very good thing.

Moreover, if I declare my own TextColor there will be two TextColor properties (yes, I could change the name of my property, but it is "standard" in b4a).
 
Upvote 0
Top