Page 1 of 1

PostPosted: Fri Apr 28, 2006 11:51 pm
by sangahm
While I'm asking for help regarding converting program code from Pocketc to Designer, I am trying to save the current graphics screen, switch to text mode, puts some text, then turn graphics back on and restore the graphics screen. The original code looks like this:

saveg();
graph_off;
clear();
puts("some text here" + "\t" + "...and here");
wait();
graph_on;
restoreg();


and so far what I've converted to:
int mymainForm;
Draw draw;
draw.begin();
draw.create(160,160);
draw.copyForm(mainForm);
draw.rect(clrFG,0,15,160,160,0);
puts("some text here" + "\t" + "...and here");
mymainForm = false;
mainForm.domodal();
while (!mymainForm) {
events(true);
}
draw.release();
draw.end();

This compiles fine, but when I run in the simulator, I get an error:
Addr: 1158
Func: showBoard // this is my function
puts not allowed in UI app

Anyone help please?

PostPosted: Sat Apr 29, 2006 2:17 am
by dewey
puts() isn't supported in OrbForms Designer, only in PocketC Architect apps that have no native UI and use the PocketC compatibility mode.

In an app with UI, create a field and add your text to it.

PostPosted: Sat Apr 29, 2006 12:24 pm
by sangahm
Thanks Dewey. As you can see I'm struggling with converting to the Designer model of programming.

After I typed this message last night, I realized that I'm trying to come at this problem wrong. I need to adjust to the event driven model. Instead of wait()'ing for a pen response, use a handler to capture the response. That's as far as I got, since I'm not quite sure how to make that leap, and the samples don't help in this area.

And I'll have to search around to find examples on using screen buffers correctly, since I don't think I converted that part of the program right.

Oh well, back to the drawing board....