2 subforms resizing correctly-how to

arcullarcull Member Posts: 191
Hi all, I'm facing this problem for years and would like to know if anyone found a proper solution to it. I have 2 subforms on a document like form (similar to sales invoice), just that I added another form in a new tab (next to Application tab) of main form. The problem occurs when resizing the main form, I would like that both subform encrease evenly without colliding to each other. Any help much appreciated.

Comments

  • AlbertvhAlbertvh Member Posts: 516
    Hi arcul,

    See the HorzGlue and VertGlue for the subforms in the Main form set them to both.

    Hope this helps

    Albert
  • arcullarcull Member Posts: 191
    thanks Albertvh, but I already tried that, the rusult aftwards is that both subforms collide together when you resize the main form :-k Any other idea maybe?
  • DaveTDaveT Member Posts: 1,039
    Hi,

    A solution of sorts to avoid the colliding is to set the top form glue properties to Both,Top - middle one to Both, Both and bottom one to Both,Bottom. This will strech all form width wise and the middle form only verticle wise.

    What is the layout you want to acheive?
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • arcullarcull Member Posts: 191
    Thanks DaveT, I know that I can set both subforms this way: the top subform (HorzGlue:Both,VertGlue:Top) and the lower subform (HorzGlue:Both,VertGlue:Both), that is how it is setup now, but when I resize the main form verticaly, the upper subform will not resize. I would like that both subforms resize verticaly without colliding. In the attachment there is a picture of how it is setup now. Thanks again.
    1.gif 23.3K
    2.gif 43.3K
  • DaveTDaveT Member Posts: 1,039
    Hi,

    The only solution I can think of is to use the idea I got from a download from this site (which I can find at the moment).

    The idea is to add code in the ontimer trigger which gets the size of the form and the sizes the control by C/AL Code

    e.g.

    // Remember these values for next time trigger goes of
    intFormStandardWidth := CurrForm.WIDTH;
    intFormStandardHeight := CurrForm.HEIGHT;

    // width,Heigth of a button
    intButtonWidth := ROUND(intFormStandardWidth / intNoOfColumns,1,'<');
    intButtonHeight := ROUND(intFormStandardHeight / intNoOfRows,1,'<');

    // Position all buttons, set their height and width
    GetXYPos(001,intXPos,intYPos);
    CurrForm.TextBox1.WIDTH := intButtonWidth; CurrForm.TextBox1.HEIGHT := intButtonHeight;
    CurrForm.TextBox1.XPOS := intXPos; CurrForm.TextBox1.YPOS := intYPos;


    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • arcullarcull Member Posts: 191
    Thanks DaveT timer seems a possible solution, I'll give it a try :)
  • prototyperprototyper Member Posts: 70
    Or.. you can use the OnDeactivate trigger for each colunm.

    columnname OnDeactivate
    ResizeSubform;

    ResizeSubform()
    Currform.subform.FORM.SetColum(1,column1.Width);
    Currform.subform.FORM.SetColum(2,column2.Width);
    etc
    SUBFORM
    SetColum(var Col, Width)
    CASE COL OF
    1 : CurrForm.column1.WIDTH := Width
    2 : CurrForm.column2.WIDTH := Width
    etc.
    CurrForm.UPDATECONTROLS;

    Tedious coding but once done it works.
    Sleep on it... The best solutions come at 2am
  • arcullarcull Member Posts: 191
    prototyper, I think the trigger OnDeactivate won't fire when I just resize the main form, even if I added code to OnDeactivate events of all controls, that still wouldn't work I guess, but thanks anyway.
Sign In or Register to comment.