Make a popup appear with cancel,ok?

Is it possible to make a popup appear with just Codea or would it need xcode runtime hooks? So you press a button and it would show an “alert” popup asking a question like “change to theme 2” cancel/ok. I don’t know the official name for it…sorry.

I’ve seen it in other apps and was wondering if it could be done with Codea.


I think this is something like what you’re after. It can be fixed up a lot more than this. Just tap cancel or ok.

function setup()

function draw()
    background(40, 40, 50)
    text("Change to theme 2",150,620)
    text("Cancel        OK",150,580)

function touched(t)
    if t.state==BEGAN then
        if t.x>50 and t.x<150 and t.y>550 and t.y<600 then
            print("Cancel pressed")
        if t.x>150 and t.x<2000 and t.y>550 and t.y<600 then
            print("OK pressed")

you would only use the xcode and runtime hooks to get the original ios popup box, if thats what your looking for? Otherwise as dave said, you can create some really nice ui elements and buttons using just codea itself. You might want to find the RoundedRect class its on here somewhere, that will make it look nicer

Yes, I meant to say the ios box…I think it’s an alert…it’s like an old style Windows popup alert box, and it comes with usually two options, cancel and ok. In Javascript it would be alert(‘hello world’);

But I do like the code dave1707 left! I’m going to try that out later. I guess it’s the only option in pure Codea

Any ideas how the ios popup could be added using the runtime?

No IOS controls inside Codea, sorry!

@david19801… By the way, @Jmv38 has a really nice windows-making utility that’s designed to help you build custom popup boxes, with ‘OK’ and ‘Cancel’ buttons included. It even does the coding for you and places it in a tab. You might want to check it out at:

@Ric_Esrey … it’s very easy to create yourself