Page 1 of 2

Bottom height (sub)form

Posted: Mon Feb 03, 2020 11:12 pm
by Jannie
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
AfterUpgrade.jpg

Re: Bottom height (sub)form

Posted: Tue Feb 04, 2020 7:20 am
by kev1n
Hi,

If you haven't done it: Check the height of each object of subform.

Re: Bottom height (sub)form

Posted: Tue Feb 04, 2020 8:45 am
by Jannie
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

Re: Bottom height (sub)form

Posted: Tue Feb 04, 2020 5:31 pm
by kev1n
Let me check if the same behavior occurs on my end. I'll get back to you.

Re: Bottom height (sub)form

Posted: Tue Feb 04, 2020 9:54 pm
by kev1n
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.

Re: Bottom height (sub)form

Posted: Wed Feb 05, 2020 10:51 am
by Jannie
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

Re: Bottom height (sub)form

Posted: Wed Feb 05, 2020 5:51 pm
by Jannie
Height of subform in grid-layout is not as height as highest element.
Example with multiselectable:
GridBeforeUpgrade.jpg
GridAfterUpgrade.jpg

Re: Bottom height (sub)form

Posted: Thu Feb 06, 2020 12:23 am
by kev1n
Will the height be correct if you undo the change, add back the + 60 ?

Code: Select all

$edit      = ['height'=>$h + 60,  'width'=> $w];

Re: Bottom height (sub)form

Posted: Thu Feb 06, 2020 8:33 pm
by Jannie
Again thank you for reply. You are so helpful!

I tested with original version (add 60px), but problem still remains. Row-Heigth remains 25px

Re: Bottom height (sub)form

Posted: Fri Feb 07, 2020 6:15 pm
by kev1n
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];
	
}