Page 1 of 1

Resize Event

Posted: Mon Jul 11, 2016 7:39 am
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.

Re: Resize Event

Posted: Mon Jul 11, 2016 11:23 am
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?

Re: Resize Event

Posted: Mon Jul 11, 2016 8:56 pm
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.

Re: Resize Event

Posted: Tue Jul 12, 2016 6:46 am
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.

Re: Resize Event

Posted: Tue Jul 12, 2016 11:05 am
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!