Resize Event

Just starting out? Need help? Post your questions and find answers here.
jamirokwai
Posts: 40
Joined: Fri Sep 25, 2015 12:00 pm

Resize Event

Post by jamirokwai »

Hi there,

Code: Select all

Procedure ResizeScreen ()
  Debug "I Am HERE!"
EndProcedure

OpenWindow (0,100,100,100,100,"")
ResizeScreen()
! $(window).resize(function(){f_resizescreen()});  
This will NOT work, if you remove the call to ResizeScreen().
In other words: ResizeScreen has to be called at least once to get the callback of the window.resize-function.

Cheers
J.
mahan
Posts: 19
Joined: Sun Nov 15, 2015 9:44 pm

Re: Resize Event

Post by mahan »

This is probably due to code generation optimization in PB, where PB-functions that are not "called" by PB-code are not included in the generated target.

Is it possible to use the internal functionality of PB to achieve what you want? Like BindEvent or something?
jamirokwai
Posts: 40
Joined: Fri Sep 25, 2015 12:00 pm

Re: Resize Event

Post by jamirokwai »

mahan wrote:This is probably due to code generation optimization in PB, where PB-functions that are not "called" by PB-code are not included in the generated target.

Is it possible to use the internal functionality of PB to achieve what you want? Like BindEvent or something?
Thanks for your answer!
Tried BindEvent, but that is tied to a SpiderBasic-window, not to the browser-window.

Cheers
J.
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Resize Event

Post by Fred »

You can use the #PB_Window_Background flag to have a fullscreen window, then you can bind a resize event on it. A procedure not used isn't included in code generation, so you need to reference it once if you plan to use it directly in inlined JS.
jamirokwai
Posts: 40
Joined: Fri Sep 25, 2015 12:00 pm

Re: Resize Event

Post by jamirokwai »

Fred wrote:You can use the #PB_Window_Background flag to have a fullscreen window, then you can bind a resize event on it. A procedure not used isn't included in code generation, so you need to reference it once if you plan to use it directly in inlined JS.

Ah, ok. Thanks, Fred!
Post Reply