Other New beta 4.2 of b4j - creating a view-wrapper-lib - facing size issues

DonManfred

Expert
Licensed User
Longtime User
Hello,

yesterday i got my view-wrap nearly to the end but i am facing some sizing issues with the custom view i created.

Adding the view with the Designer results in another size than adding the view by code.

I figured out that the different size comes from the TEXT size i can change in the Designer. If i set a value of 30 for ex. the view will be showed bigger than with a 15 textsize.

The problem is, that the wrapped (ToggleView) view does not have a Textsize property; so i cant reate getters and setters for the property.

How can i add Getter and setter for the textsize i a view itself does not have a property (and getter/setter for them? In this case the view itself i build opon a label and the view itself i think....
 

Daestrum

Expert
Licensed User
Longtime User
Is the ToggleView a class, if so you may be able to use extend if your library is in java.
ie, Class MyVersionOfTheToggleView extends ToggleView{

Then you should be able to add the getter/setter and any other fields you want.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I usually used the b4a objet ViewWrapper<Objecttowrap> which gives me directly all it needs to add the view to a parent and so on.
In b4j it is now the
B4X:
ControlWrapper<ToggleSwitch>

MAybe i´m doing it wrong, maybe i need to go another way. I´m in the learning phase of writing wrappers for b4j ;)

But as this new CustomProperties for Customviews is one of the wishes i placed (maybe double) in the wish-list i really was HOT to try this new feature and started to build a first wrapper... :)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can add this code in DesignerCreateView method to set the ToggleSwitch text size and other text related properties:
B4X:
getObject().setStyle(lbl.getStyle());
Like many other properties in JavaFX the text size is set in the CSS style.
Developers can use CSSUtils to later change it. You don't need to add such property in your code.
 
Upvote 0
Top