I have a form with two frame controls that are in the same position and made visible (or not) in the OnAfterGetCurrRecord trigger depending on a field value. All works great but… If I design the form again and then save it, the next time I try and design the form I get an error ‘A cyclical parenthood (the Frame Named X as ‘parent’ of the Frame named Y) would be the result’. Followed by an ‘Internal error 1 in module 5’. [B)] Ok - no problem - I exported the object as text, edited the resulting file, located the frame control and removed the ParentControl and InFrame properties it had decided to add, imported and compiled. Form works fine, can be designed until it is saved again and the problem comes back [Duh!] Nice bug in designer [:(] I can live with this, it just means I need to go through a long-winded process every time I need to update the form or I could split the frames onto two subforms and show the correct one as appropriate (overkill but will solve the issue). Does any one have any ideas of a way around this, or am I missing something? Navision client version is 4.0 GB.
Haven’t checked but the following should help. The problem happens because each time you redesign one of the frames you drag it from it’s current position. Once you drag it back, you will make a frame sit inside the other one. This is my guess… The best thing to do is design the frames on 2 different positions and once you are happy with whatever you changed, you can drag one of them into the correct position, make a note of that frame’s XPos and YPos and manually assign the same values to the second frame. This should avoid the frame-in-frame error. One different approach, but the best if the form will be designed often, is to take the Navision’s wizard-form solution. During design, you just have the frames sitting somewhere off the normal margins of the form. Then, during runtime, you programatically make then overlap at the correct position, adjust the form size to be smaller and hide/unhide the frames (as you do now). This way you can see both frames apart at design time.
Always more than one way to skin a cat… The method I use is as follows. If you drag the cotrol, then you have a problem, BUT whilst resizing you dont get the problem. So what I do, is instead of dragging, I resize, so you just drag in two steps, first resize to move the left part of the fram, the resize the right part of the frame to the same position. Nelsons method of using dynamic repositioning is really the best solution, but its a lot of work.
A-ha! Resizing is also cool!
Thanks for the help guys. Strangely enough it’s not just dragging a frame onto another frame that causes the problem. Designing and then saving a form with overlapping frames causes the problem if if you do not change anything on the form. I took the approach of having the frames side by side and then moving o the frame by changing the XPOS in the ONOPENFORM trigger. This solves the problem.
That really should not happen, are you perhaps sharing the same caption control or something else odd, maybe you have common partent controls for the frames?
David, I agree with you that it ‘shouldn’t’ happen but I can reproduce it consistently. As a test I created a blank form. Added two frame controls then moved one over the other. I exported this to text and made sure that the InFrame and ParentControl properties were not set for either frame. I can run the form fine. Design the form and then save it without moving or changing anything and it will set one frame as the parent of the other. [Sigh…] Doesn’t matter as I have my work around now but defo a bug there. Thanks for your help.