[squeak-dev] How to catch #inform: messages?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] How to catch #inform: messages?

Damien Cassou-3
Hi,

I would like to catch calls to (UIManager default inform:) to
automatically click ok. I'm trying:

[UIManager default inform: 'truc'] valueSuppressingMessages: #('truc').


without success. Can somebody help me please?

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Igor Stasenko
On 04/03/2008, Damien Cassou <[hidden email]> wrote:

> Hi,
>
>  I would like to catch calls to (UIManager default inform:) to
>  automatically click ok. I'm trying:
>
>  [UIManager default inform: 'truc'] valueSuppressingMessages: #('truc').
>
>
>  without success. Can somebody help me please?
>
Create class:
------
MorphicUIManager subclass: #MyUIManager
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: '...'

MyUIManager>>inform: aString
" do nothing"
--------

Then set default ui manager:

oldManager := UIManager default.
UIManager default: MyUIManager new.
.. run your code ..
UIManager default: oldManager.

>  --
>
> Damien Cassou
>
>


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Igor Stasenko
or even you may try the same, but without need in creating a class:

oldMethod := MorphicUIManager methodDictionary at: #inform:
MorphicUIManager compileSilently: 'inform: aMessage  "do nothing"'
classified: 'dumb'.

.. run your code..

MorpicUIManager addSelectorSilently: #inform: withMethod: oldMethod


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Bert Freudenberg

On Mar 4, 2008, at 8:59 , Igor Stasenko wrote:

> or even you may try the same, but without need in creating a class:
>
> oldMethod := MorphicUIManager methodDictionary at: #inform:
> MorphicUIManager compileSilently: 'inform: aMessage  "do nothing"'
> classified: 'dumb'.
>
> .. run your code..
>
> MorpicUIManager addSelectorSilently: #inform: withMethod: oldMethod

How utterly evil ;)

You would at least have to use an #ensure: block. And also you would  
need to verify that the code did not actually compile a new version  
of #inform.

A less evil way would be to make #inform: use a Notification that  
could be handled to suppress the UI.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Igor Stasenko
On 04/03/2008, Bert Freudenberg <[hidden email]> wrote:

>
>  On Mar 4, 2008, at 8:59 , Igor Stasenko wrote:
>
>  > or even you may try the same, but without need in creating a class:
>  >
>  > oldMethod := MorphicUIManager methodDictionary at: #inform:
>  > MorphicUIManager compileSilently: 'inform: aMessage  "do nothing"'
>  > classified: 'dumb'.
>  >
>  > .. run your code..
>  >
>  > MorpicUIManager addSelectorSilently: #inform: withMethod: oldMethod
>
>
> How utterly evil ;)
>
>  You would at least have to use an #ensure: block. And also you would
>  need to verify that the code did not actually compile a new version
>  of #inform.
>
>  A less evil way would be to make #inform: use a Notification that
>  could be handled to suppress the UI.
>
Hehe, just a snippet to show a direction without much care of details :)
>
>  - Bert -
>
>
>
>


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Matthias Berth-2
In reply to this post by Damien Cassou-3
Hi Damien,

Installer does something like that out of the box, check out
Installer>>answer:with:. See
http://wiki.squeak.org/squeak/PierInstallerScript for an example. BTW,
you can answer: '*some question*' with: true.

Cheers

Matthias

On Tue, Mar 4, 2008 at 8:32 AM, Damien Cassou <[hidden email]> wrote:

> Hi,
>
>  I would like to catch calls to (UIManager default inform:) to
>  automatically click ok. I'm trying:
>
>  [UIManager default inform: 'truc'] valueSuppressingMessages: #('truc').
>
>
>  without success. Can somebody help me please?
>
>  --
>  Damien Cassou
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] How to catch #inform: messages?

Damien Cassou-3
Hi Matthias,

On Tue, Mar 4, 2008 at 7:57 PM, Matthias Berth
<[hidden email]> wrote:
>  Installer does something like that out of the box, check out
>  Installer>>answer:with:. See
>  http://wiki.squeak.org/squeak/PierInstallerScript for an example. BTW,
>  you can answer: '*some question*' with: true.


In fact, I'm using Installer and Installer is doing what I wrote in
the first post... and it doesn't work :-(.


--
Damien Cassou