Forums

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

Home Forum Omnis General Forum Getting the page number that an object is on, inside a $sendall

  • Getting the page number that an object is on, inside a $sendall

    Posted by Paul Mulroney on August 17, 2021 at 1:04 pm

    Hi $All,
    I’ve done this before, I’m sure of it! But I’m having brain fade.
    We validate our fields on a window by doing a $sendall, and then displaying the result to the user.
    It looks something like this:

    Calculate isErr as ”
    Calculate isWarn as ”
    Do $cwind.$objs.$sendall($ref.$validate)
    If len(isErr)
    OK message Validate {[isErr]}
    Quit event handler (Discard event)
    Else If len(isWarn)
    Yes/No message Validate {[isWarn]Continue anyway?}
    If flag false
    Quit event handler (Discard event)
    End If
    End If

    In this particular case, I have a paged pane, and I only want to validate fields on eg page 2. I know that I can specify a condition in the $sendall, and I know that there’s a $panenumber() method that will tell me which pane an object is on.
    I think it should be something like this:

    Calculate pnCurrentPage as 1
    Do $cinst.$objs.PagedPane.$objs.$sendall($ref.$validate,$cinst.$objs.PagedPane.$panenumber($ref)=pnCurrentPage)

    But this doesn’t do anything. Has anyone done anything like this before?
    All help gratefully received.
    Regards,
    Paul.
    Two Eskimos sitting in a kayak were chilly, so they lit a fire in the craft. Unsurprisingly it sank, proving once again that you can’t have your kayak and heat it too.

    Paul Mulroney replied 2 years, 11 months ago 1 Member · 1 Reply
  • 1 Reply
  • Paul Mulroney

    Member
    August 19, 2021 at 1:50 am

    Hi Everyone,
    With help from the list, and some personal replies, here’s what I found:
    At first, I couldn’t get the $sendall to work, so I coded this which did work:

    Do vlObjects.$define(vrObject) ;Create a list of objects that we want to work with
    Do $cinst.$objs.PagedPane.$objs.$sendall(vlObjects.$add($sendallref)) ;Add all objects from this page pane into a list
    Begin reversible block
    Set current list vlObjects
    End reversible block
    For each line in list from 1 to #LN step 1
    If $cinst.$objs.PagedPane.$panenumber(vlObjects.vrObject)=pnCurrentPage ;This is on the page that we want to validate
    Do vlObjects.vrObject.$validate() ;Call this specific validate method
    End If
    End For

    Then I received a couple of replies, which led me to this:

    Do $cinst.$objs.PagedPane.$objs.$sendall($ref.$validate(),$cinst.$objs.PagedPane.$panenumber($sendallref)=pnCurrentPage)

    Note using $ref in the first part, and $sendallref in the second part.
    See also this tech note which explains it more fully: https://www.omnis.net/developers/resources/technotes/tngi0027.jsp
    Regards
    Paul.

Log in to reply.