Bottom height (sub)form

Questions related to using nuBuilder Forte.

Bottom height (sub)form

Postby Jannie » Tue Feb 04, 2020 7:42 am

Today I upgraded to newest nuBuilder4 from version may 2019
After that all my forms have a big bottom margin. It's not possible to reduce it by editing the form.
Does somebody have an easy way to remove this extra margin?
BeforeUpgrade.jpg
Before upgrade
BeforeUpgrade.jpg (16.58 KiB) Viewed 129 times

AfterUpgrade.jpg
After upgrade
AfterUpgrade.jpg (24.15 KiB) Viewed 129 times
Jannie
 
Posts: 15
Joined: Sun Jun 10, 2018 12:06 am

Re: Bottom height (sub)form

Postby kev1n » Tue Feb 04, 2020 3:50 pm

Hi,

If you haven't done it: Check the height of each object of subform.
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: Bottom height (sub)form

Postby Jannie » Tue Feb 04, 2020 5:15 pm

Thank you for your reply. I already checked and searched further for reason.
I have found: Same problem is with all my subforms which have form-type 'Form'. All those forms have a minimal height as shown. Subforms with type 'grid' are OK

When looking in development mode of my browser, I see that element height is increased in inline style of form. No padding found.
Same issue with a brand new (empty) nubuilder-database on which I tested by creating two tables with persons/addresses
Attachments
FormTypeForm.jpg
FormTypeForm.jpg (18.87 KiB) Viewed 111 times
Jannie
 
Posts: 15
Joined: Sun Jun 10, 2018 12:06 am

Re: Bottom height (sub)form

Postby kev1n » Wed Feb 05, 2020 2:01 am

Let me check if the same behavior occurs on my end. I'll get back to you.
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: Bottom height (sub)form

Postby kev1n » Wed Feb 05, 2020 6:24 am

I compared an old version of nuform.php with the current one and noticed that in the current version, the height of the form is increased by 60. That's why you see this gap.

Code: Select all
$edit      = ['height'=>$h + 60,  'width'=> $w];


Code: Select all
$edit      = ['height'=>$h,  'width'=> $w];


https://github.com/steven-copley/nubuil ... .php#L1352

If this + 60 is removed, the gap will be gone.
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: Bottom height (sub)form

Postby Jannie » Wed Feb 05, 2020 7:21 pm

This works, but I'll come back because during testing all my forms, I see there is also something wrong with height in grid subforms. Example is following within a few days
Jannie
 
Posts: 15
Joined: Sun Jun 10, 2018 12:06 am

Re: Bottom height (sub)form

Postby Jannie » Thu Feb 06, 2020 2:21 am

Height of subform in grid-layout is not as height as highest element.
Example with multiselectable:
GridBeforeUpgrade.jpg
GridBeforeUpgrade.jpg (50.91 KiB) Viewed 86 times

GridAfterUpgrade.jpg
GridAfterUpgrade.jpg (62.51 KiB) Viewed 86 times
Jannie
 
Posts: 15
Joined: Sun Jun 10, 2018 12:06 am

Re: Bottom height (sub)form

Postby kev1n » Thu Feb 06, 2020 8:53 am

Will the height be correct if you undo the change, add back the + 60 ?

Code: Select all
$edit      = ['height'=>$h + 60,  'width'=> $w];
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: Bottom height (sub)form

Postby Jannie » Fri Feb 07, 2020 5:03 am

Again thank you for reply. You are so helpful!

I tested with original version (add 60px), but problem still remains. Row-Heigth remains 25px
Jannie
 
Posts: 15
Joined: Sun Jun 10, 2018 12:06 am

Re: Bottom height (sub)form

Postby kev1n » Sat Feb 08, 2020 2:45 am

Another thing you could try:

Replace the function nuFormDimensions() in nuform.php with this one (taken from an older nuBuilder version).

Code: Select all
function nuFormDimensions($f){

   $d         = array();
   $t         = nuRunQuery("SELECT * FROM zzzzsys_form WHERE zzzzsys_form_id = '$f'");
   $r         = db_fetch_object($t);
   
   $bt         = 57;    //-- browse title
   $rh         = intval($r->sfo_browse_row_height)    == 0 ? 25 : $r->sfo_browse_row_height;
   $rs         = intval($r->sfo_browse_rows_per_page) == 0 ? 25 : $r->sfo_browse_rows_per_page;
   $bb         = 25;   //-- browse footer
   $t         = nuRunQuery("SELECT * FROM zzzzsys_object WHERE sob_all_zzzzsys_form_id = '$f'");
   $h         = 0;
   $w         = 0;
   $gh         = 0;
   $gw         = 0;
   
   while($r   = db_fetch_object($t)){
      
      if($r->sob_all_type == 'lookup'){
         
         $w    = max($w, $r->sob_all_left + $r->sob_all_width + $r->sob_lookup_description_width + 40);
         $gw   = $gw + $r->sob_all_width + $r->sob_lookup_description_width + 40;
         
      }else{
         
         $w    = max($w, $r->sob_all_left + $r->sob_all_width + 40);
         $gw = $gw + $r->sob_all_width + 4;
         
      }

      $h      = max($h, $r->sob_all_top + $r->sob_all_height);
      $gh    = max($r->sob_all_height, 25, $gh);

   }

   $bh         = $bt + ($rs * $rh) + $bb;
   $bw         = nuGetBrowseWidth($f);   

   $grid      = ['height'=>$gh, 'width'=> $gw];
   $browse      = ['height'=>$bh, 'width'=> $bw];
   $edit      = ['height'=>$h,  'width'=> $w];


   
   $d[]      = $bt + ($rs * $rh) + $bb;          //-- lookup browse height
   $d[]      = nuGetBrowseWidth($f);   
   $d[]      = $h  + 0;                     //-- lookup form height
   $d[]      = $w  + 0;                     //-- lookup form width
   $d[]      = $h  + 0;                     //-- form height
   $d[]      = $w  + 50;                     //-- form width
   $d[]      = $gh + 0;                     //-- grid height
   $d[]      = $gw + 55;                     //-- grid width
   
   $d[]      = ['browse'=>$browse, 'edit'=>$edit, 'grid'=>$grid];

   return ['browse'=>$browse, 'edit'=>$edit, 'grid'=>$grid];
   
}
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Next

Return to General