$04 Suppressing OK message

Marten Verhoeven m.verhoeven at van-beek.nl
Thu Jun 23 08:59:54 EDT 2016


Hi Ben,

First of all: I don't think you should do this at all. It is bad code because you are building a quick and dirty solution. If you often use these solutions your code will get really hard to maintain and expand. The proper way to do things is to separate the functionality from the user interface. You call the functionality from the user interface (and show dialogs there when needed), or you call the functionality from your automation routines. You are better off investing your time in such a cleaner design.

That said: you cannot prevent the built in message boxes from popping up, but you can when you use your own message box. If you wrap this message box in your own message object, you can create some kind of global flag which tells the object to suppress all messages (and therefor will not show them when you set the flag at the start of your automation procedure).

And the nice thing of Omnis is: you can easily create a function which replaces all use of the built in message boxes with your own implementation. I did the exact same thing when I wanted to change the message box design and wanted to implement multi language support. The function I created went through all of my source code and replaced the built in message boxes, extracted all texts from it and created proper string-tables to access them. From then off you have your own implementation so it is easy to add functionality to it (for example have a button to specific help pages when an error occurs).

With kind regards,

Marten Verhoeven


-----Oorspronkelijk bericht-----
Van: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Namens Ben Price
Verzonden: vrijdag 17 juni 2016 8:05
Aan: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Onderwerp: Re: $04 Suppressing OK message

Hi List,

I think I have found a solution but it's not pretty (an elegant solution would be preferable) and I hope my interpretation of $findreplace using regex works!

On loading my automated task I can loop through all $clib.$classes and call $findreplace('^.*OK Message.*$','^;.*OK Message.*$',ktrue,kfalse,
ktrue) on each class which should comment them all out.

At the end of task I can then  $findreplace('^;.*OK Message.*$','^.*OK Message.*$',ktrue,kfalse, ktrue) to put them all back.

--
All the best,

Ben Price
Software Engineer
p: (08) 8203 0550


On Fri, Jun 17, 2016 at 3:12 PM, Ben Price <ben at clintelsystems.com <mailto:ben at clintelsystems.com>> wrote:

    Hi List.

    I have written a automated process which opens up windows and prints
    records, but on any one of the windows an OK box may be presented to
    the user if the data or setup for the data is incorrect.

    Is there any way in Omnis 4 to be able to suppress OK messages so
    automated process to operate without user intervention?

    -- 

    All the best,

    Ben Price
    Software Engineer
    p: (08) 8203 0550

    _____________________________________________________________
    Manage your list subscriptions at http://lists.omnis-dev.com


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com




More information about the omnisdev-en mailing list