Wish Allowing Libraries to add custom Properties to be used in a CustomView in Designer

DonManfred

Expert
Licensed User
Allowing Libraries to add custom Properties to be used in a CustomView in Designer
In the last weeks i have wrapped some libraries. Some of them have their own Properties.
I wish i could write a code in a library which will be called from the designer to get a list of properties.

Possible Types of Properties i saw so far:
- int
- double
- float
- long
- String
- Color
- fontsize
- fontface
- width
- height
- bitmap
- image
- drawable(s)

It would be great if we, the librarydeveloper, could design properties of a new view which then all can be set in the designer
 

Cableguy

Expert
Licensed User
Question: Will existing CustomViews automatically exhibit the custom properties in the designer or will they need to be exposed like the event is?
 

DonManfred

Expert
Licensed User
Good question. I guess @Erel is building something new here. Somewhere in forum he wrote that B4J libraries are not able to use customviewwith designer support at this time and it will be changed in future.

Now, seeing his answer here is guess it is much more than just the possibility to use customviews with designersupport...

It must be more. I like this more; what ever it will be ;-)
 

Erel

Administrator
Staff member
Licensed User
Another example, this time it is for a B4X class:






The properties are declared like this:
B4X:
#Event: DateChanged (NewDate As Long)
#DesignerProperty: Key: CancelVisible, DisplayName: Cancel Visible, FieldType: Boolean, DefaultValue: True, Description: Whether the cancel button should be displayed.
#DesignerProperty: Key: TodayVisible, DisplayName: Today Visible, FieldType: Boolean, DefaultValue: True
#DesignerProperty: Key: Modal, DisplayName: Modal Window, FieldType: Boolean, DefaultValue: True, Whether the window should be modal.
#DesignerProperty: Key: MinYear, DisplayName: Minimum Year, FieldType: Int, DefaultValue: 1970, MinRange: 0, MaxRange: 3000
#DesignerProperty: Key: MaxYear, DisplayName: Maximum Year, FieldType: Int, DefaultValue: 2030, MinRange: 0, MaxRange: 3000
#DesignerProperty: Key: FirstDay, DisplayName: First Day, FieldType: String, DefaultValue: Sunday, List: Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday, Description: Sets the first day of week.
#DesignerProperty: Key: Title, DisplayName: Title, FieldType: String, DefaultValue: Select Date
#DesignerProperty: Key: BackgroundColor, DisplayName: Background Color, FieldType: Color, DefaultValue: #FFCFDCDC
#DesignerProperty: Key: SelectedColor, DisplayName: Selected Color, FieldType: Color, DefaultValue: 0xFF0BA29B
#DesignerProperty: Key: HighlightedColor, DisplayName: Highlighted Color, FieldType: Color, DefaultValue: 0xFFABFFFB
New class template:

 

DonManfred

Expert
Licensed User
#DesignerProperty: Key: Modal, DisplayName: Modal Window, FieldType: Boolean, DefaultValue: True, Whether the window should be modal.
Should´nt it not be
#DesignerProperty: Key: Modal, DisplayName: Modal Window, FieldType: Boolean, DefaultValue: True, Description: Whether the window should be modal.
?
 

ArminKH

Well-Known Member
wooooooooooooooooow thank u erel
looks great ;)
but it seems Custom Properties is accessible from B4A Classes only ! ?
what is the implementation for java when we want to wrap a view?
sorry i can't wait for next version :D
 
Last edited:

DonManfred

Expert
Licensed User
They can also be added to Java libraries.
How can i use
#DesignerProperty: Key: CancelVisible, DisplayName: Cancel Visible, FieldType: Boolean, DefaultValue: True, Description: Whether the cancel button should be displayed.
in a java-library?

I guess there is now something new like the @commands? Maybe
B4X:
@DesignerProperty(...)
 
Top