Forums

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

Home Forum Omnis General Forum Custom OK Message Window

  • Custom OK Message Window

    Posted by Gerardo on November 12, 2019 at 9:29 pm

    I want to create a window that behaves like the OK message. When the window is open the calling code should pause until the child window is closed. What window properties and calling code are required to make this work?
    This is what I have calling the child window:
    ; Calling child window here – code execution should pause after calling:
    Do $clib.$windows.wOKMessage.$openmodal(‘*’,kWindowCenterRelative,$topwind) Returns rWin
    ; This and all lines below should not process until wOKMessage is closed.
    Not sure if this is possible in Omnis.

    Paul Mulroney replied 4 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Paul Mulroney

    Member
    November 13, 2019 at 1:03 am

    This is definitely possible!
    You need to have something like this in the $construct:
    enter data
    if flag true
    ; user has clicked OK
    else
    ; user has clicked cancel
    end if
    do $cwind().$close
    quit method <some result>
    You should have an OK button with the $buttonmode set to kBMok, and a cancel button with the $buttonmode set to kBMcancel
    The window should have the $modelessdata set to false – you want the window to only be enterable while the enter data command is in effect.
    Note that there are some differences between a true OK message and one that we create:
    – A true OK message will stop ALL execution of ALL code. There is absolutely nothing that I’m aware of that will do the same for us.
    – It WILL stop the currently executing method, but it won’t stop events from occurring, so you can trap events, or have timer objects fire etc.
    Hope this helps!
    Regards,
    Paul.

  • Gerardo

    Member
    November 13, 2019 at 4:26 pm

    Thanks Paul! Your solution works well.

  • Paul Mulroney

    Member
    January 20, 2020 at 8:26 am

    You’re welcome!

Log in to reply.