Page 1 of 2

resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 2:32 pm
by Andrea
Hi all,

just a question regarding resizing of browse forms.

I set automatic column widths at my browse form.
The width of the browse form adjusts to the size of the web browser window when opening the form but if the web browser window is not maximized that moment and you then maximize it the width of the browse form does not adjust again. It keeps the old width.
I need to reload (F5 or Enter in web browser address field).

This behaviour is the same in different web browsers on pc.

Is it possible to change this to always fit the maximized browser window? Perhaps by getting screen resolution instead of browser window size?

Thankyou very much in anticipation &
Best wishes

Andrea

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 2:43 pm
by gerese
It's not exactly a solution to your problem, if you use it:

Code: Select all

nuStopBrowserResize();
the dimensions of the columns will keep the size as you set it, regardless of the size of the window.

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 3:04 pm
by kev1n
Add this code before the function nuOnLoad() under Setup-> Header:

Code: Select all

function nuResizeBrowseColumns(force){

	var w	= nuFORM.getCurrent().column_widths;
	var t	= 0;
	var p	= nuTotalWidth('nucell_0_0') - $('#nucell_0_0').width();	//-- padding

	if((nuFORM.getCurrent().refreshed != 0 && force !== true)  && nuMainForm()){return;}

	if(nuMainForm()){

		for(var i = 0 ; i < w.length ; i++){
			t = t + w[i];
		}

		for(var i = 0 ; i < w.length ; i++){
			w[i] = parseInt((window.innerWidth - 30) * w[i] / t) - p;
		}

	}else{

		var W	= nuTotalWidth('nuBrowseFooter') + 22;

		$('#nuDragDialog',	window.parent.document).css('width', W + 14);
		$('#nuWindow',		window.parent.document).css('width', W);

		$('body').css('width', W);//.css('padding', '0px 0px 0px 7px');

	}

	if(nuFORM.getCurrent().refreshed != 0 && force !== true){return;}

	nuSetBrowserColumns(w);

}

$(window).resize(function() {
 clearTimeout(window.resizedFinished);
    window.resizedFinished = setTimeout(function(){
          if (!nuIsIframe())  nuResizeBrowseColumns(true);
    }, 250);
});

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 4:15 pm
by gerese
Super cool!

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 4:15 pm
by kev1n
@gerese: There's an option in the form settings that was added some time ago.
auto.jpg

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 9:08 pm
by gerese
Hi Kev1n,

Hi Kev1n, I have this behavior with the window resizing code when I try to access the properties of an object:
ResizeForm.gif

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 9:20 pm
by kev1n
This should fix it:

Code: Select all

$(window).resize(function() {
 clearTimeout(window.resizedFinished);
    window.resizedFinished = setTimeout(function(){
          if (!nuIsIframe())  nuResizeBrowseColumns(true);
    }, 250);
});

Re: resizing browse form to fit webbrowser window

Posted: Fri Jan 14, 2022 9:32 pm
by gerese
Work great ! Thx

Re: resizing browse form to fit webbrowser window

Posted: Sat Jan 15, 2022 12:42 pm
by Andrea
Wonderful! :D :D :D
Many thanks!

Andrea

Re: resizing browse form to fit webbrowser window

Posted: Sat Jan 15, 2022 12:58 pm
by Andrea
I just sent a donation by paypal to say thankyou.
Nubuilder is wonderful and your support is great! Many thanks for all your efforts!!!

Best wishes

Andrea