Wish Option to automatically set tag to object name.

73Challenger

Member
Licensed User
Option to automatically set object tag to object name or possibly event name as well in designer.

I pretty much set the tags to the object names, this option would save me quite a bit of time building and maintaining my more complex designer forms.

Thanks @Erel
 

luc-dev

Member
Licensed User
Longtime User
Option to automatically set object tag to object name or possibly event name as well in designer.

I pretty much set the tags to the object names, this option would save me quite a bit of time building and maintaining my more complex designer forms.

Thanks @Erel

A menu entry in the designer tools menu like names to tags would be nice, so all selected views would have there tags matching their names. Useful when you need to load the layout (sub-layout in many cases) in another utility module and then bind the loaded views. Here is a suggestion:

Designer Menu Entry: Tools → Set Tags from Names (or similar)
  • Applies to selected views or all views in the current layout
  • Automatically assigns each view's Tag property to match its Name property
  • Works across all B4X platforms (B4A, B4i, B4J)

Current (Manual):

For each view in designer:
1. Select view
2. Go to Properties panel
3. Set Tag = Name manually
4. Repeat for 20+ views...


Proposed (Automated):

1. Select multiple views (or Select All)
2. Tools → Set Tags from Names
3. Done! All selected views now have Tag = Name

Implementation Suggestions​

  • Menu Location: Tools menu in Visual Designer
  • Shortcut: Maybe Ctrl+Shift+T
  • Options:
    • "Set tags for selected views only" (default)
    • "Set tags for all views in layout"
    • "Overwrite existing tags" checkbox
    • Preview dialog showing "Name → Tag" mappings before applying

Alternative/Additional Features​

  • Event Name Option: Could also set tags to match event sub names (e.g., Button1_Click → tag: Button1)
  • Reverse Operation: Set Names from Tags for the opposite direction
  • Bulk Tag Operations: Pattern-based tag setting (prefix, suffix, etc.)

Benefits​

  • Time Saving: Eliminates repetitive manual tag assignment
  • Error Reduction: No typos in tag names
  • Consistency: Ensures tags always match names
  • Modularity: Better support for sub-layout loading patterns
  • Tool Integration: Enables better external tool support (like BalConverter workflows)

Based on forum discussions, many developers manually set tags to match names for various binding scenarios. This feature would benefit the entire B4X community working with complex, modular applications.
 

stevel05

Expert
Licensed User
Longtime User
Sounds like something you could do most of with a Designer Script Extension.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Try the attached. It is a B4j Project, but copy the modules to B4a and it should work as is . Can't test in B4i, Not sure it will work without modding. Or create a B4xLib.

You may want to exclude customviews as their Pane tags are already used.

See Post #5
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
This version Excludes Custom Views, and modded and tested with B4a
 

Attachments

  • DSE_ViewTotag.zip
    4.7 KB · Views: 54
Last edited:

luc-dev

Member
Licensed User
Longtime User
Thank you for your help and the nice piece of code you provided!

I was not aware you could extend the designer script.
I did put DSE_ViewToTag.bas and VTT_Utils.bas in project path.
Auto completion works in designer with DSE_ViewToTag so I guess the setup is OK, but none of the views.tag are set when I run the script, save the layout or reopen it.

I must be doing something wrong...


Capture d’écran 2025-07-01 à 16.13.01.jpg

I
 

luc-dev

Member
Licensed User
Longtime User
Thank you, I was wrong assuming the changes were reflected in the designer. It is fine with me then. I am quite struggling with bindings and I think I will end up using class wrapper to load the sub_layout I need (mainly in listviews).
 

stevel05

Expert
Licensed User
Longtime User
If you are looking at data encapsulation for the layout have a look at my new project ClassFromLayout and it's map interface. It may help or at least give you a different option.
 
Top