B4J Question [D.S.E.] - Need a pratical example...

Cableguy

Expert
Licensed User
Longtime User
I'm posting this in B4J forum, but it could have been posted in any of the other platforms (B4R excluded).

I once replied to a user thad wanted to create a theme function for his app, and my answer was that the new Designer Script Extension would make that easier to accomplish...

I based my answer on one of the examples EREL had posted - This one

Yesterday I decided to put that "idea" of a Theming framework into code... basing myself on the example above....
But EREL's examples are getting a bit... harder to follow, specially when it comes just as a snippet.


Designer script:
B4X:

B4XMainPage.SetTextColor(Button1, DDD.Color("small text"))
B4XMainPage.SetTextColor(Button2, DDD.Color("0xFFD776B0"))
B4XMainPage.SetTextColor(Label9, DDD.Color("Red"))


B4X:
B4X:

dd.Initialize
xui.RegisterDesignerClass(dd)
dd.AddColor("small text", xui.Color_Magenta)
Root.LoadLayout("MainPage")

'View, Color
Private Sub SetTextColor(DesignerArgs As DesignerArgs)
Dim view As B4XView = DesignerArgs.GetViewFromArgs(0)
Dim clr As Int = DesignerArgs.Arguments.Get(1)
view.TextColor = clr
End Sub

I just can't figure out what kind of object is dd.
No DesignerScript object contain the .addcolor method!!!

SO... I kindly ask, an exmple, as clear as possible, were a color is added by name, and then used in code to change any given view's color, as one would when selecting a theme...

This may seem quite trivial, but in my mind, I am still strugling to find the "engine start" button of this new feature, the DSE.
 
Check the DesignerUtils library in the Libraries Manager Tab.
And in B4XMainPage declare:
Private dd As DDD

You might have a look at the B4X Visual Designer Booklet chapter: Designer Script Extension.
Thanks for replying Klaus, but DDD does not have the .AddColor method used in Erel's example... So I'm back at point zero
 
Upvote 0
Back
Top