Noob trying to make simple quiz app can't find how to paste text from clipboard into program

Hi, I am trying to make a simple app that let’s me paste questions/ answers from the clipboard into a text box on the screen, and the way that I have formatted the spacing of the text, the program can decipher which are the questions and which are the corresponding answers.

But I can’t get past the initial stage of pasting in the text.

My only coding experience is with basic like 20 years ago, and making music programs with Reaktor(a join the boxes up graphic programming environment).

In Script kit( another Lua app) to get a paste able text box you just use this snippet below.

ti = textinput.new(“Helvetica”, 22, press)----------------------------------------------------------------------------------------------------------
screen.add(ti)--------------------------------------------------------------------------------------------------------------------------------------------

(Wow would be nice if the ipad let you hold your finger on the keyboard to make those lines above to hold the snippet format in place)

But the program seems to hide a lot of stuff, and is clunky.

Please help Codea guru’s I am loosing heart, and starting to think I’m to old learn this stuff.

.

Im am new to Codea too, so I can’t help you with the code but:

Use three tilde (~) characters at the start and end of your code block. So it looks like this:


Your code

And your are not to old. Here are lot of old guys (e.g. me) learning new tricks. See how we started in the “On what machine did you write your first code” discussion…

Thanks DaDo.

@Asynchronous - I’ve not tried myself, but this discussion on Cider might help. It’s code for building up windows style interfaces.

http://twolivesleft.com/Codea/Talk/discussion/1693/cider-interface-builder-code-generator/p1

It should allow you to create a text box, then (hopefully) a long hold will allow you to paste in stuff from the clipboard.

However, after a quick search using the new forum search box :wink: I came across this thread which seems to suggest that importing via the clipboard might not be so straightforward

http://twolivesleft.com/Codea/Talk/discussion/627/importing-code-via-clipboard/p1

:-/

@Asynchronous - if you are planning to make a stand alone app, this won’t be enough, but in the Codea editor, you can set parameters, including a textbox.

This code will allow you to paste into a textbox at left of screen, and process the text when you press the button underneath.

function setup()
    parameter.text("Question")
    parameter.action("Process",processText)
end

function processText()
   print(Question) 
end

Please be aware, however, that Codea isn’t the ideal program for what you want. Codea is an animation program that redraws the screen 60 times a second, suitable for games, puzzles, anything that moves. Codea doesn’t even have text boxes (except in the editor for development purposes).

If you want a static program with textboxes and forms, you might be better to look at something like pythonista.

Thanks for all your help guys :slight_smile:
I have pythonista, but haven’t really had a look at it yet because Codea seemed easier and is more polished, but will give it a look.

I tryed to load the cider code but it gave an error of looking for some file that didnt exist.

Will give the above snippet a go.

Thanks again guys.

@Asynchronous Can you give me an example of a question and answer that you want to cut and paste. Maybe I can help if I see exactly what you want to do.

EDIT: What I was thinking isn’t going to work. @Ignatz way is the easiest.