0

是否可以以简单的方式向用户显示警报?就像是:

save

  title
    ifEmpty: [ 'Title cannot be empty' alert ]
    ifNotEmpty: [ "…do the saving…" ]

这样,如果titleivar 为空,用户将看到带有相应消息的对话框。

4

3 回答 3

2

您可以(在某种程度上)调整对话框窗口,然后再用一个块显示它。

就像在带有红色边框的屏幕上居中一样。

UIManager default 
      alert: 'Something is wrong' 
      title: 'Issue ahead' 
      configure: [ :d | d position: Display center; borderColor: Color red].
于 2014-10-13T10:40:10.927 回答
1

这将是:

self inform: 'Title cannot be empty'

但老实说,我对此并不满意,因为它就像一个咆哮通知。

大多数时候,这正是你想要的,但有时你需要一个模态通知......无论如何,这就是你所需要的 :)

于 2014-08-14T09:54:47.123 回答
0

yes it is

for a typical error dialog you can use this piece of code

UIManager default abort: 'Title cannot be empty'.

for a growl messages that the user has not to click on ok button you can use this

UIManager default inform: 'Data has been saved'.

UIManager has actually a lot of options on this and a lot of messages you can use. Just explore the class and I am sure you will find something that fits your needs.

于 2014-10-11T09:06:48.600 回答