Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

resizing browse form to fit webbrowser window

Questions related to using nuBuilder Forte.
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

resizing browse form to fit webbrowser window

Unread post 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
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: resizing browse form to fit webbrowser window

Unread post 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.
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: resizing browse form to fit webbrowser window

Unread post 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);
});
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: resizing browse form to fit webbrowser window

Unread post by gerese »

Super cool!
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: resizing browse form to fit webbrowser window

Unread post by kev1n »

@gerese: There's an option in the form settings that was added some time ago.
auto.jpg
You do not have the required permissions to view the files attached to this post.
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: resizing browse form to fit webbrowser window

Unread post 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
You do not have the required permissions to view the files attached to this post.
nuBuilderForte .... BIG Like !!!
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: resizing browse form to fit webbrowser window

Unread post by kev1n »

This should fix it:

Code: Select all

$(window).resize(function() {
 clearTimeout(window.resizedFinished);
    window.resizedFinished = setTimeout(function(){
          if (!nuIsIframe())  nuResizeBrowseColumns(true);
    }, 250);
});
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: resizing browse form to fit webbrowser window

Unread post by gerese »

Work great ! Thx
nuBuilderForte .... BIG Like !!!
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Re: resizing browse form to fit webbrowser window

Unread post by Andrea »

Wonderful! :D :D :D
Many thanks!

Andrea
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Re: resizing browse form to fit webbrowser window

Unread post 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
Post Reply