ID:169322
 
How does one make an alert pop up that allows users to select items from a list, confirm their choice with an OK button, or cancel with a Cancel button.

I'm currently doing it with input() and adding "Cancel" to the end of the list, but I'd rather have a nice little button.

I'd rather not use arguments in a verb because that doesn't allow for me to set prompts/titles on the popup box.
F1 alert(). You can enter names for up to three buttons.
In response to Artekia
But how do you combine buttons and lists?
Add null to the types of input it takes.
client/verb/test()
var/item = input("Choose one.")as null|anything in list("a","b")
if(!item)return
src << item
In response to Fartmonger
You can't. I don't know if that will be a feature in 4.0, I hope so, but you can't at the moment.
In response to Loduwijk
Oh thank'ee kindly, that's exactly what I was looking for =)
In response to Fartmonger
Wah? What do you mean? Do you mean like:
mob/verb/test()
var/list/l=list("Hi, world!","Bye, world!","Nothing")
var/t=alert(src,"What would you like to say?","Say",l[1],l[2],l[3])
if(t!="Nothing")world<<t

?
In response to Loduwijk
How would you do it with an input box with Ok and Cancel for a msg to the world, but instead of having to choose Okay or Cancel theres a text input box. Just the buttons are there.
In response to Niran
Something like this?
mob/verb/WSay()
var/msg=input("What do you want to say to the world?","Wsay") as null|text
world << "[src]: [msg]"

Arguments already have cancel buttons, but they don't allow you to define titles and messages on the box.
In response to Fartmonger
I am just wondering but. I am used to use:
(var/msg as text)

But is that null you putted there really needed? If so why?

O-matic
In response to O-matic
O-matic wrote:
I am just wondering but. I am used to use:
(var/msg as text)

But is that null you putted there really needed? If so why?

O-matic

It wasn't needed, I was wrong, but I ninja edited it to fix it :P

The problem I have with using args is you're not allowed to define what it says in the input box... at least, as far as I know, you're not.