Forums

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

Home Forum Omnis General Forum Toast Messages

  • Toast Messages

    Posted by Silvan Baach on September 7, 2022 at 8:21 pm

    Hi,

    I have a question regarding the $showtoast command in Omnis 10. I noticed that the message only gets drawn after all operations on the stack are completed.

    Example:

    Do $cinst.$showtoast(‘Info’,’Infotext’,kToastInformation)

    Do sleep(5000)

    Quit Method

    This Toast gets printed at the end of the Method. It doesn’t matter if its a sleep command or another Omnis instruction like calling a method.

    Is there any way to force the draw of the toast message?

    Thanks!

    – Silvan

    • This discussion was modified 1 year, 10 months ago by  Silvan Baach.
    Deleted User replied 1 year, 9 months ago 3 Members · 8 Replies
  • 8 Replies
  • Andreas Pfeiffer

    Administrator
    September 9, 2022 at 6:47 am

    Hello Silvan,

    The reason why this happens might be that you run the code server side. Omnis automatically synchronises all instance variables in that instance with the client (browser). In that moment it will also send any client command to the browser. So in a way you would need to think asynchronously when it come to communication with the client.

    What is the reason you want any other code after your message? Maybe I can help you finding a different approach to achieve what you want?

    Best,

    Andreas

    • Silvan Baach

      Member
      September 9, 2022 at 7:24 am

      Hello Andreas

      I’m working on a desktop based application without a client server hierarchy. I don’t really get why I need to think asynchronously in this case.

      What I want to achieve:

      Let’s say I have a window with a huge treelist and some configuration fields for the user. If a pushbutton gets pressed I want the whole window to reload its data. Before running the main logic of this procedure I want to inform the user that the window now starts reloading. The goal is to use the toasts kind of as status updates but not as “extreme” as working messages would do. And besides that: The toasts are designed nicer then working messages and they don’t interfere with the user as much.

      So in short:

      Step 1. Inform the user that the window is reloading

      Step 2. Reload the window

      Step 3. Inform the user that the window reload has been successful

      Thanks for your help!

      – Silvan

  • Andreas Pfeiffer

    Administrator
    September 9, 2022 at 7:38 am

    Hi Silvan,

    Now I understand your requirement.

    This is something that you can achieve using an overlay. There is a sample library “JS Loading Overlay” in the samples section of your HUB.

    You can also achieve this using a toast message if you want:

    1. Put your code that loads the data into another method (not the $event method that you use to load the data)

    2. Make the $event method of your button that is used to load the data “client executed”. You can do this using the context menu onto the method name.

    3. Then the first line in your $event method after the on evClick will be to start the toast message. After that you would then call your server side method using the “Do method” command.

    I.E.

    On evClick

    Do $cinst.$clientcommand(‘showtoast’;row(‘loading’))

    Do method loadList

    So, since the $event method will now be executed on the client the toast message will appear first and then the data will be loaded on the Omnis server.

    I hope this makes sense.

    Best regards,

    Andreas

  • Andreas Pfeiffer

    Administrator
    September 9, 2022 at 7:44 am

    .. and finally you can have another toast message in your loadList method that will come last.

    Best,

    Andreas

    • Silvan Baach

      Member
      September 9, 2022 at 7:55 am

      Hi Andreas

      Thanks for the fast answer!

      I see what you are going for. But I don’t use any JS in my application. My Code isn’t located in a remoteform but in a standard windowclass instead. Therefore this solution is not possible am I right? I would need to put the reload code in another thread so the main stack stays empty and the toast gets printed… But I never really understood multi threading in Omnis for desktop application purposes.

      – Silvan

  • Andreas Pfeiffer

    Administrator
    September 9, 2022 at 8:03 am

    Hi Silvan,

    ok – I did not know that you are working on fat client windows. Sorry.

    You may want to use a timer object to achieve this. I would personally not use a toast message for this rather some kind of animation. There is also a sample app for this.

    Hope this helps.

    Best,

    Andreas

    • Silvan Baach

      Member
      September 9, 2022 at 8:13 am

      Alright thanks! I didn’t found the time to really dig into the new animation feature but I’ll give it a shot.

      – Silvan

  • Deleted User

    Deleted User
    October 3, 2022 at 8:35 pm

    Nice post guys

Log in to reply.