ID:176656
 
How would I make buttons that do something (when clicked) in an html popup? You double click a car and an html popup with information about the car appears, and I would like to have a buy button and a cancel button. Thanks.
OneFishDown wrote:
How would I make buttons that do something (when clicked) in an html popup? You double click a car and an html popup with information about the car appears, and I would like to have a buy button and a cancel button. Thanks.

Alright, it sounds like you want to check out the htmllib. Mess around with that for a while. Basically, you just create a form object and display it when the object is clicked.
Form/Stats
form_window = "window=carstats"
var
tmp/speed
tmp/cost
tmp/car
cancel
cancel_interface = BUTTON
buy
buy_interface = BUTTON
HtmlLayout()
return \
{"
Car:
[car]<br>
Speed:
[speed]<br>
Cost:
[cost]<br>
[buy][cancel]<br
"}

buyClick()
usr << browse(, "window=carstats")//close the window
usr.Buy(car)
cancelClick()
usr << browse(, "window=carstats")//close the window

obj/car
var
cost
speed
Click()
var/Form/Stats/s = new()
s.car = src
s.cost = cost
s.speed = speed
s.DisplayForm()


Something like that should work. This is probably really confusing, which is why you should study the htmllib's readme carefully.
In response to TE
You forgot to define the button's click procs as procs.
In response to Nadrew
Nadrew wrote:
You forgot to define the button's click procs as procs.

I think he got the idea though =P.
In response to Ebonshadow
I haven't tried it yet, but I hope I would've been able to figure out an "undefined proc" error. You never know though, it is late. Thanks again for your help : )