$currentlayoutbreakpoint in a JavaScript remote form

Bruno Del Sol bruno.delsol at bydesign.fr
Tue Jul 24 11:11:26 EDT 2018


Hi,

As Graham said, trapping on evLayoutChanged will let you store the value of pBreakpoint.

This event is fired on actual layout changed, ie when the window is resized enough, and also when the form is 
constructed, either server side or client side.

Subforms do NOT get the event, so you have to trap it on a parent's form $event, and then pass the stored value of 
pBreakpoint to the subform(s).


also, things can get tricky if you try to control both evLayoutChanged and evScreenOrientationChanged, so Support states 
this :

"Currently, evScreenOrientationChanged only fires on screen size based $layouttype forms, responsive forms instead fire 
evLayoutChanged and single layout forms don’t fire either.

An enhancement has been made to Omnis Studio version 9.0 to fire evScreenOrientationChanged in all layout types, and 
returns pOrientation, which will have the value kOrientPortrait or kOrientLandscape."

HTH

Regards

Bruno


By Design
http://www.bydesign.fr
Bruno Del Sol
bruno.delsol at bydesign.fr
tel (33) 01 48 78 47 37
46, rue de La Tour d'Auvergne
75009 Paris (France)

Le 24/07/2018 à 15:25, Graham Stevens a écrit :
> Hi Reg,
>
> Haven't had a problem here.  In the superclass for all our responsive forms we have the following $event method set to 
> "Execute on client":
>
> ;  overload this method for form specific changes based on breakpoints
> ;  evLayoutChanged MUST be set in the subclass $events
> On evLayoutChanged
>     Calculate inBreakpoint as pBreakpoint :: inBreakpoint is an 32bit integer instance variable in the superclass
>
> And then in our subclasses' $event we can do:
>
> On evLayoutChanged
>     Do inherited
>
>     Switch inBreakpoint
>         Case 320
>             Do ...
>         Case 480
>             Do ...
>         Default
>              Do ...
>     End Switch
>
> HTH,
> Rgds,
>
> Graham
>
> On 24/07/2018 14:10, Reg Paling wrote:
>> Hi all,
>>
>> Has anyone had success with getting the current layout breakpoint in a JSform at runtime?
>>
>> I've tried $cinst.$currentlayoutbreakpoint and $cwind.$currentlayoutbreakpoint.
>>
>> I've tried trapping evLayoutChanged and tried to save the pBreakpoint.
>>
>> Can't seem to get it, neither in browser nor on my phone.
>>
>> Thanks, Reg
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 




More information about the omnisdev-en mailing list