简体   繁体   English

显示警报的简便方法

[英]Easy way to display alert

Is it possible to display an alert for user in an easy way? 是否可以通过简单的方式为用户显示警报? Something like: 就像是:

save

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

so that if title ivar will be empty user will see the dialog with appropriate message. 因此,如果title ivar将为空,则用户将看到带有相应消息的对话框。

You can (somewhat) tweak the dialog window before showing it up with a block. 您可以(有点)调整对话框窗口,然后再显示一个块。

Like centering it on screen with a red border. 就像在屏幕上居中显示红色边框一样。

UIManager default 
      alert: 'Something is wrong' 
      title: 'Issue ahead' 
      configure: [ :d | d position: Display center; borderColor: Color red].

it would be: 这将是:

self inform: 'Title cannot be empty'

but to be honest, I'm not happy with it, because is like a growl notification. 但老实说,我对此不满意,因为这就像咆哮的通知。

Most of the time, that's exactly what you want, but some times you need a modal notification... anyway, that's what you need :) 在大多数情况下,这正是您想要的,但是有时您需要模式通知...无论如何,这就是您所需要的:)

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. UIManager实际上有很多选择,您可以使用很多消息。 Just explore the class and I am sure you will find something that fits your needs. 只是探索课程,我相信您会找到适合您需求的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法在Android下的警报中显示自定义异常? - Is there a way to display a custom exception in an alert under Android? Tkinter屏幕更改为更改的显示-纠正的简便方法? - Tkinter Screen Change as Altered Display - Easy way to rectify? Matlab-保存整个图形/ GUI的简便方法 - Matlab - Easy way to save entire figure/GUI 有导航列表的简便方法吗 <t> 宾语? - Is there an easy way to navigate a List<t> object? 以逻辑易用的方式存储和呈现数据 - Storing and presenting data in logical and easy to use way Java Swing或SWT:构建桌面UI“向导”的简便方法 - 建议? - Java Swing or SWT: easy way to build a desktop UI “wizard” — suggestions? 在 OS-X 中使用鼠标启动 Python 脚本的简单方法 - Easy way to launch Python scripts with the mouse in OS-X 向 C 介绍课程展示 GUI 开发的简单方法 - Easy way to show a GUI development to a C introduction course 在GTK中,有没有一种简单的方法可以按任意数量缩放所有小部件? - In GTK, is there an easy way to scale all widgets by an arbitrary amount? 有没有一种简单的方法可以在ListView中拖动项目以更改其顺序? - Is there an easy way to drag items around in a ListView to change their order?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM