cancel
Showing results for 
Search instead for 
Did you mean: 

Scope controls by screen instead of all being global

It'd go a long ways for project organization on large projects with many screens if the controls on any given screen were scoped to that screen and accessed using dot notation or "control accessor" notation. Here's an example:

 

ScreenA

--- Input1

--- Input2

 

ScreenB

--- Input1

--- Input2

 

With scoped controls, both screens can have controls with the same name (which allows names to remain short), and if you need to access another screen's controls, you'd do so like so:

 

ScreenB.Input1

 

This way, all controls are still accessible globally, but the names can be simplified and shortened if there are a lot of similarly named controls on separate screens. As is now, my names are getting excessively long as I try to keep them organized since I have about 8 screens that need to share many of the same names for controls (see the attached image to get an idea of what I mean).

Status: New
Comments
Level: Powered On

Yes, this will make thing simpler and most useful when we copy controls from on screen to other.

Level 10

Oke, I understand the question, but there is a downside when this would be changed. In this case you have to connect to a control with a reference to the screen.control. Will the reference to the screen change with moving the control?

 

What I do is add a short prefix to the screen name, mostly S01, S02,S03 and I use this prefix in my controlnames, so S01_Controlname. A form I just call F01, F02, F03, etc. and a gallery just G01,G02, etc. Say a start off a personal naming convention. Mayby using this will keep your names shorter. 

Level: Powered On

The way I see it working would be that, if referencing a control on the current screen, you'd just reference it by the control name. If referencing a control from a different screen than the current, you'd identify the screen. So let's say we have ScreenA and ScreenB:

 

ScreenA

--- F01

------ F01_Name

------ F01_Email

 

ScreenB

--- F01

------ F01_Name

------ F01_Email

 

If we are on ScreenA:

 

"F01_Name" would get us that input from ScreenA

"ScreenB.F01_Name" would get us the input from ScreenB

 

If you move the controls from ScreenA to ScreenB, that control would then be nested under ScreenB and could be referenced as such. It'd behave in the same way as copying and pasting an object from one class to another in an object-oriented programming language.

 

I already do prefix my controls with the screen identifier (ie. ScreenA_F01_Name), but that's starting to get unruly and when copying and pasting controls between screens you have to manually go in and change the screen prefix. This would essentially solve that problem by automatically prefixing controls based on the screen they are on and only using the prefix when needed.