Designer Scripts

CharlesIPTI

Active Member
Licensed User
Longtime User
I've added my Views by Code

Can I not position these Views(controls) dynamically in Designer scripts. I.E Do they have to exist in the layout to be manipulated by the Designer Scripts...

The views do not Confirm their existence (color change to purple) when referenced in the Designer Script Window) like the Views I used in my test project -- which existed in the Abstract designer

I'm assuming this is an easy Yes... the views must physically exist in the Abstract designer to be adjusted/positioned dynamically by the Designer script
ADDENDUM:: OK so I added a few of the view to test this theory and it appears to be true. but additionally you appears to have to Dim the views in Sub Globals even thought you've added them to the Abstract designer ....

Apparently No Initialize either.. labels have to have their text set in the scripts not in code too I suppose the text would set in the designer too but I had it initialized in code first .. so I put it in the script, I guess it would work in the designer too

Addendum::: Controls added in the abstract designer do not add to the activity with Activity.AddView(blah,blah,blah,blah,blah )
 
Last edited:

rfresh

Well-Known Member
Licensed User
Longtime User
You cannot code everything in the Designer Scripts. They don't support most of the commands (I believe on purpose). Apparently, it's not the same code parser that is used in the main IDE.

The Designer Scripts are only for View positioning/layout and appearing in v1.90, it was huge improvement in development layout speed with so many Variants (screen resolutions) that we have to use.
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Yes

My discoveries may assuredly be related to that fact that I got into this from creating the views in code...

so I just happened to notice the limitations as i was trying to get the script designer to recognize my views.

The critical point in my post was that the views apparently MUST exist in the Abstract designer to be manipulated by the script designer..

I see singleline property was not accepted for my edit text box but the text property for my label was .. as you stated not all properties will be accessible.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
>The critical point in my post was that the views apparently MUST exist in the
>Abstract designer to be manipulated by the script designer.

Yes.
 
Upvote 0

duneplodder

Active Member
Licensed User
Longtime User
"but additionally you appears to have to Dim the views in Sub Globals even thought you've added them to the Abstract designer ...."

It would certainly be nice if this could be automated in some way.
 
Upvote 0

duneplodder

Active Member
Licensed User
Longtime User
Amazing, I use this frequently to generate code for events like click or long click but hadn't spotted this.

Thank you agraham.
 
Upvote 0

jfranz

Member
Licensed User
Longtime User
script over dynamic views

I have been questioning the same thing. I was wondering if the designer code could be called for say a panel that had dynamic controls added to them. This way each panel could layout controls based on the same rules. I was starting to write something like this that took xml and created controls for a scrollview and realized that Erel's design would work exactly like I wanted. I believe that all this would need is the parent view and some rules about the children contained within.

Erel, If this isn't available today can I get some code that you wrote to deal with this. I don't care if its in Java, C#, VB.net or B4A basic. I will continue to work on my hack but thought that just maybe I might get lucky.

Thanks
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
"but additionally you appears to have to Dim the views in Sub Globals even thought you've added them to the Abstract designer ...."

It would certainly be nice if this could be automated in some way.


Dude feel FREE to correct my Krazy Type-o's
"but additionally you appear○ to have to Dim the views in Sub Globals even though○ you've added them to the Abstract designer ...."

The point was ( although you've now been pointed to that menu option to generate members hahaha) that my coded views ( not in the visual designer) cannot be manipulated (structured) by the designer scripts... makes sense now in hindsight designer / designer
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Actually it is possible to apply a designer script on runtime views.

You can call Activity.RerunDesignerScript to only run the script section of the layout file.
The script accesses the views based on the global variable name.
For example you can do something like:
B4X:
Sub Globals
 Dim Button1 As Button
End Sub

Sub CreateManyViews
 For i = 1 to 100
  Dim b As Button
  b.Initialize("")
  Panel1.AddView(b, 0, 0, 100dip, 100dip)
  Button1 = b
  Activity.RerunDesignerScript("Layout1", Panel1.Width, Panel1.Height)
End Sub
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Follow up confirmation

Good Morning Erel,, or evening for you I guess

So your saying the layout graphics portion is empty but its script section manipulates Button1 ????
or per your example Panel1?

Can it manipulate both of these views?
You called the panel but the button is on Globals ---> :)

My project demands have basically brought me to inline hand coding the views.
Painstakingly adding (through automation modules) and manually building my custom, Types to "Segregate" views into their appropriate categories
,, only to ultimately break them from this relationship (removeView) so I can throw them on a panel and the panel into the activity.. ( ahem excuse me everyone but UGGG !!!)

The possibility of creating view heavy layouts, and a designer script (apparently the original functional design) seems more apropos in the future.
I however worry that my 'massive' creations may not be appropriate for this strategy and I have adopted the custom "Type" style for my use, as you've seen in my project examples....

If a layout however represented a Panel or some other construct that I could place MANY of ---on an activity, and this layout itself could contain other layouts AGAIN with their designer scripts now that would be handy.

Lets forget the latter request of depth, as it basically exists already, but just multiple layouts placed onto an activity.. Then I could create a "panel" with all of its complex children (probably more panels holding various views) and throw that onto the activity within a panel that constrains its size and do the same ,, apply other layouts,,, in this puzzle style creation onto the same activity....

We all know what I mean the plate is the activity but it could accept multiple layouts


plastic-compartment-plate-250x250.jpg


the layouts of course have even more sub sectioned complexity there-in

DSCF7380.JPG



I have problems with a code module not really being a formal class and a 'Type' not having member methods. I find these "limitations" very formidable hurdles in my attempt to creating clean elegant code.


:confused:

but then again
I'm working without a formal spec
or any guidance
so I earnestly appreciate all of your assistance...!!

:icon_clap: :sign0060: :D

Thanks for the follow up ..
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If I correctly understand your case you do not need to use RerunDesignerScript. You should just create small layout files and then add them at runtime one or more times with Panel.LoadLayout.

The panels should be added programmatically.

The code in the designer script will treat 100%x and 100%y as the panel's width and height.
 
Upvote 0

jfranz

Member
Licensed User
Longtime User
Possible to create new script

Erel, I asked about this in a different section using the Hybrid layout and things got a little mixed up.

I was hoping that I could create a dynamic layout and then apply a dynamic script for the new layout on a panel. More specifically I am creating XML to dynamic create controls (probably using reflection) to add them in a panel which gets added to a scrollview. The panel's width would be set to its parent width before calling the script process

This idea hopefully will reduce at least 4-5 activities and layouts into 1 with a set of rules done in XML. Early stages but should be doable.

Maybe this is an enhancement but at a 10,000 foot view it looks like it should work. Not sure if you compile the designer scripts in Java or not, but if you do that might be a problem.
 
Upvote 0
Top