Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum $currentlayoutbreakpoint not behaving as expected

  • $currentlayoutbreakpoint not behaving as expected

    Posted by Uwe Smidt on November 16, 2023 at 5:01 pm

    Dear $all,

    I’m using the current Omnis 11 release, and when trying to figure out which layout is rendered during runtime, I’m evaluating the $currentlayoutbreakpoint property.

    First problem is that using $cinst. or $iremoteforms.$currentlayoutbreakpoint throws a notation not supported error.

    Second problem: when using $remoteforms.rfMyForm.$currentlayoutbreakpoint it only gives the Layout breakpoint selected in design mode, not the one just being rendered in the browser..

    Any ideas?

    Thanx in advance!

    Uwe

    Uwe Smidt replied 1 week, 1 day ago 3 Members · 5 Replies
  • 5 Replies
  • Michael Monschau

    Member
    November 16, 2023 at 8:54 pm

    Hi Uwe,

    The notation $cinst.$currentlayoutbreakpoint must be executed in a client executed method as that is where the property $currentlayoutbreakpoint applies. It does not exist on the server.

    The notation $remoteforms.rfMyForm… addresses the remote form class, not the runtime form instance and hence it only reports the breakpoint set in design mode.

    The. notation $iremoteforms.$currentlayoutbreakpoint is not valid without the instance name of the remote form instance, i.e. $iremoteforms.rfMyForm.$currentlayoutbreakpoint, however as I mentioned above, $currentlayoutbreakpoint can only be read on the client so addressing $iremoteforms will be of no use.

    Kind regards,

    Michael

  • Uwe Smidt

    Member
    November 17, 2023 at 11:21 am

    Hi Michael,

    This makes perfect sense – thanks for your help!

    Best regards

    Uwe

  • Uwe Smidt

    Member
    November 19, 2023 at 4:10 pm

    Damn… still not working!

    I put

    Do inherited
    Calculate myVariable as $cinst.$currentlayoutbreakpoint
    If $cinst.$currentlayoutbreakpoint=320
    Do $cinst.$objs.native_list.$width.$assign(10)
    Else If $cinst.$currentlayoutbreakpoint=768
    Do $cinst.$objs.native_list.$width.$assign(100)
    Else
    Do $cinst.$objs.native_list.$width.$assign(0)
    End If

    in my remote forms $init, but $cinst.$currentlayoutbreakpoint just doesn’t do anything

    Any ideas?

    Thanks in advance

    Uwe

    • Götz Krija

      Member
      November 20, 2023 at 12:39 pm

      Hi Uwe,

      You can override the Remoteform’s $event method and use evLayoutChanged which has a parameter pBreakpoint that contains the integer value of the (new) layout break point:

      On evLayoutChanged
      If pBreakpoint=320
      Do $cinst.$objs.native_list.$width.$assign(10)
      Else If pBreakpoint=768
      Do $cinst.$objs.native_list.$width.$assign(200)
      Else
      Do $cinst.$objs.native_list.$width.$assign(0)
      End If

      Götz

      • This reply was modified 1 week, 2 days ago by  Götz Krija.
  • Uwe Smidt

    Member
    November 21, 2023 at 4:54 pm

    Dear Götz,

    Yep, that worked fine!

    Thank you!

    Uwe

Log in to reply.