B4J Question Does LoadLayout clear the Pane's Tag property?

LucaMs

Expert
Licensed User
Longtime User
Does LoadLayout clear the Pane's Tag property?

I think so and I struggled to find a bug in my project that was due to this fact.

I don't understand that thing. I have a Pane, I set its Tag with a text, I load a layout (views/nodes inside the Pane) and this clears the Tag?!
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
This post is just to let @Informatix know why this emptied tag has complicated things for me.

How to detect the pane on which the user has performed the "dropping"?

I have some Panes in which the programmer loads a layout.
The "dropping" ends up on a node (view) of the programmer, but I have to detect the node that contains the layout, this is the target of the operation.
I had to create a recursive routine to trace the parents of the "dropping" node but not up to the top-parent, up to the one whose tag had the value I gave it.

Complicated. Complicated even to explain it. The animated gif shows that by passing the cursor over any node the programmer has loaded in the TreeNode, the target is recognized (don't mind the bad look, it's temporary).

How much effort

 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
For me it makes sense that the tag property is overwritten, since we can set the tag value in the layout designer
You have a Pane in the Designer and you set its Tag to "Hello".
In your source, you load a layout INTO that Pane; you still need that Tag, there's no point in emptying it.

It is changing the value of a Pane property just because you have loaded a layout into it.
Its properties must remain unchanged.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
You write yourself there is 'no tag property' in the beginning step of the designer layout. Then you reload the beginning designer layout. Why do you want to deviate from the beginning situation where the Tag value was not set as default behavoir? The solution is to save the current Tag value and other things you want to reuse or save, reset the current layout by loading the default layout and set the saved values back. This does raise the question whether you really need a (partial) reset with reloading the layout or whether it is better to just overwrite some current values to reflex the current situation?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
It was discussed at some point. It is indeed a bug however I wasn't thrilled to fix it as it may break existing code that relies on the tag being empty.

I just wanted to inform the people in this thread that I referred to this in a new Wish I just posted:

 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
It was discussed at some point. It is indeed a bug however I wasn't thrilled to fix it as it may break existing code that relies on the tag being empty.
Fix it with a compiler switch to turn on the fix? Keep that for a couple of years while people update code?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…