Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Make a popup appear with cancel,ok?

edited March 2013 in General Posts: 43

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.

Thanks.

Tagged:

Comments

  • dave1707dave1707 Mod
    Posts: 8,464

    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() end function draw()     background(40, 40, 50)     rectMode(CENTER)     fill(255)     rect(150,600,200,100)     fill(255,0,0)     text("Change to theme 2",150,620)     fill(0,255,0)     text("Cancel        OK",150,580) end 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")         end         if t.x>150 and t.x<2000 and t.y>550 and t.y<600 then             print("OK pressed")         end     end end
  • Posts: 1,595

    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?

  • Posts: 666

    No IOS controls inside Codea, sorry!

  • Posts: 140

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

    http://twolivesleft.com/Codea/Talk/discussion/2542/a-windows-utility#Item_16

  • Posts: 68

    @Ric_Esrey ... it's very easy to create yourself

Sign In or Register to comment.