0

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.

Uko
  • 13,134
  • 6
  • 58
  • 106

3 Answers3

2

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].
philippeback
  • 781
  • 7
  • 10
  • nice , I really like UIManager and I am surprised it does not pop up more often in these type of questions :) – Kilon Oct 14 '14 at 17:23
1

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 :)

EstebanLM
  • 4,252
  • 14
  • 17
  • Yes, but this is really about informing. I was wandering if there is an easy way of opening dialog window with message – Uko Aug 14 '14 at 09:56
  • well... that's what I said is missing. I would really like something like "informModal:" around... :( – EstebanLM Aug 14 '14 at 09:57
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.

Kilon
  • 1,962
  • 3
  • 16
  • 23