SmallTalk Asynch GUI Updates

I wondered if anyone could help me with the technique solve the following problem in Smalltalk. In particular, Cincoms Visualworks.

I would like to encode a simple graphical interface that has three fields and processes them as follows:

The first field enters a number (for example, 5).

The second field simply displays the first field twice (therefore, in this example, it displays 10)

Now, an interesting bit ... the third field displays a value from a completely different class (let it be called class X). However, the value must be displayed in the graphical interface each time this value in class X is changed - it should not wait for the key from the refresh button to be pressed. The value in class X can be obtained from (say) the workspace.

I, although I could do this using adapters in terms of, but I can not get the "third field value" to be updated asynchronously.

Any methods, hints or tips would be most warmly welcome - (especially the code snippets!).

Thanks Kevin

+3
source share
1 answer

I made it out myself. After checking the dependency mechanism (it works fine, but just doesn’t need it), looking at the ads (thanks to James at Cincom - private message), I found that all I had to do was just create a method and send it a message with the parameter ( my value), this method then simply updated the value holder (that is, an aspect of the GUI field) with the message "value:". The more I look at Smalltalk, the more I like it!

+3
source

Source: https://habr.com/ru/post/1705507/


All Articles