If I have a label that is part of a table layout, and I change it to another component via the source tab, I lose my layouts.
Even a name change of a component from RPa to RPb for example, I lose the layout. Is there a way to make the IDE not delete my layout items?
Editing source and Layouts disappearing
Editing source and Layouts disappearing
Art Tostaine
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Editing source and Layouts disappearing
Hi Art
Changing the name of a component shouldn't result in the layout item being disconnected, unless you try really hard e.g. change the name to the name of a different Define_Com might do it.
However, as you've discovered, changing the class of a Define_com will result in the Manage parameter of the layout item being set to *Null. The reason for this is that while the Class parameter is being modified, the Define_Com is invalid. This results in a layout item with no purpose cluttering up your code.
The best way to stop this happening is to use search/replace so that the change is made in a single action. Alternatively, there's the technique I heartily endorse, which is to stop tinkering with the source and let the designer do all the work for you.
Regards
Changing the name of a component shouldn't result in the layout item being disconnected, unless you try really hard e.g. change the name to the name of a different Define_Com might do it.
However, as you've discovered, changing the class of a Define_com will result in the Manage parameter of the layout item being set to *Null. The reason for this is that while the Class parameter is being modified, the Define_Com is invalid. This results in a layout item with no purpose cluttering up your code.
The best way to stop this happening is to use search/replace so that the change is made in a single action. Alternatively, there's the technique I heartily endorse, which is to stop tinkering with the source and let the designer do all the work for you.
Regards
Re: Editing source and Layouts disappearing
If i have 2 or 3 layouts, I delete the component in the designer, drag the new one in it's place, I lose all 3 layouts. I'm missing something how the designer will do the work, even with just one layout.Stewart Marshall wrote:Hi Art
The best way to stop this happening is to use search/replace so that the change is made in a single action. Alternatively, there's the technique I heartily endorse, which is to stop tinkering with the source and let the designer do all the work for you.
Regards
Thanks
Art Tostaine
Re: Editing source and Layouts disappearing
Hi Art,
Are you saying the entire layout is being deleted? I seem to recall having the same issue a few weeks ago as I was CONSTANTLY re-creating my layouts.
I have found that if I delete the component in the designer then it is going to actually remove that component from the source which will hose up (I think delete) my other layouts as a LayoutItem is now missing its managed component.
I've struggled with the multiple layouts thing quite a bit myself and I have found that you don't want to delete the component, you just want to hide it. http://vlforum.lansa.com.au/viewtopic.php?f=3&t=1171
So what I have started doing is getting an initial layout in place, then hiding the components with Visible = False. Make sure you turn off the "Show Controls" option in the design tab on the Home ribbon bar. You can use the outline window to see them. Then get your new layout in place and set it to the active layout. Then show one control, by selecting it in the Outline Window (it will likely be in the wrong place) and move it to its new layout location and set the layout attributes. Show another control and move it to its new location. etc.
Hope this helps.
Joe
Are you saying the entire layout is being deleted? I seem to recall having the same issue a few weeks ago as I was CONSTANTLY re-creating my layouts.
I have found that if I delete the component in the designer then it is going to actually remove that component from the source which will hose up (I think delete) my other layouts as a LayoutItem is now missing its managed component.
I've struggled with the multiple layouts thing quite a bit myself and I have found that you don't want to delete the component, you just want to hide it. http://vlforum.lansa.com.au/viewtopic.php?f=3&t=1171
So what I have started doing is getting an initial layout in place, then hiding the components with Visible = False. Make sure you turn off the "Show Controls" option in the design tab on the Home ribbon bar. You can use the outline window to see them. Then get your new layout in place and set it to the active layout. Then show one control, by selecting it in the Outline Window (it will likely be in the wrong place) and move it to its new layout location and set the layout attributes. Show another control and move it to its new location. etc.
Hope this helps.
Joe
Re: Editing source and Layouts disappearing
I don't lose the layout, I lose the layout items for that component. I'll have to specify, row, column, flow, sizing, etc.
If I use find/replace, I guess the layout items would get changed first since they are at the top of the source.
If I use find/replace, I guess the layout items would get changed first since they are at the top of the source.
Art Tostaine
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Editing source and Layouts disappearing
When you delete a control in the designer it will delete the Define_Com for the control and any associated layout items. When you add a new one you will need to lay it out for each of the layouts in the component. When I say the designer will do all the work, I simply mean that it will get the code right for you with a point and click or two. This is far easier that hacking around in the source and obviously much less error prone.
If you must use Find/Replace, it will work because it makes the changes within a single "unit of work". Effectively, all the source is changed and the IDE then determines what that means. Individual key strokes are also "units of work", which means that after each one, the IDE tries to work out what's going on. This typically results in issues, particularly when changing a class name, as previously explained,
Tinkering in the source will likely result in something changing that you didn't expect. The IDE does a lot of work to maintain the code state and to ensure that names hook up correctly etc. This is why I thoroughly recommend letting the designer do the work.
If you must use Find/Replace, it will work because it makes the changes within a single "unit of work". Effectively, all the source is changed and the IDE then determines what that means. Individual key strokes are also "units of work", which means that after each one, the IDE tries to work out what's going on. This typically results in issues, particularly when changing a class name, as previously explained,
Tinkering in the source will likely result in something changing that you didn't expect. The IDE does a lot of work to maintain the code state and to ensure that names hook up correctly etc. This is why I thoroughly recommend letting the designer do the work.
Re: Editing source and Layouts disappearing
How would you use the designer to change a component from something like a repository field to a label?Stewart Marshall wrote: This is why I thoroughly recommend letting the designer do the work.
Art Tostaine
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Editing source and Layouts disappearing
There's no way in the designer to change the class of a component. You have to delete it and then add a new one.
Is the change from a field to a label just a random example, or is there a specific requirement? I ask because we added the DisplayOnly property to fields for v14 so that they behave just like a label rather than an edit.
Is the change from a field to a label just a random example, or is there a specific requirement? I ask because we added the DisplayOnly property to fields for v14 so that they behave just like a label rather than an edit.
Re: Editing source and Layouts disappearing
I had a label to display some footer information. We decided to change it to an Html container.
I can live with find/replace. Once again I'd like to say thanks for the opportunity to have a dialog with you and the other experts.
Art
I can live with find/replace. Once again I'd like to say thanks for the opportunity to have a dialog with you and the other experts.
Art
Art Tostaine