Problem with sample app from docs

Discuss topics that apply across the products, such as the PocketC language, or development in general

Postby reh on Thu Jul 20, 2006 8:07 pm

I'm having some trouble moving from PocketC (where I wrote dozens of short, working apps) to PocketC Architect. So I've studied the examples in the documentation carefully. Here's one that baffles me -- my questions are listed as comments at the end of the code. Thanks in advance for any answers. (I will study some of the working sample apps as well, in hopes of understanding this software.)

-- Rachel Holmen, Berkeley, CA, USA

//from the Pocket C Architect documentation

@app myApp {
creator = "MyAp";
name = "App Name";
dbname = "AppName-MyAp";

@form myForm {
id = 1000
text = "My Form"
x = 0, y = 0, w = 160, h = 160

field nameField {
id = 1001
x = 10, y = 60, w = 140, h = 12

button alertButton {
id = 1002
x = 60, y = 80, w = 40, h = 12
text = "My Button"

// a global variable to hold the salutation.
string text;

// the handler for when the app is started
handler myApp.onstart() {
// load the main form

// a function to build the text for the alert
string buildText(string name) {
return "Hello, " + name;

// the handler for the button, which displays the alert
handler alertButton.onselect() {
text = buildText(nameField.text);

// Comments by R Holmen -- why does the second iteration of the button show different text than the first?
// Is this to be an example? Or is it just sloppy programming?
// You cannot enter any data into the Namefield, even though a blinking cursor and an underscore appear on the form
// The dialog box, therefore, displays only the word "Hello, " without adding a name.
// What code is required to allow data entry into Namefield?
// What is needed to display "Hello, Jim." -- assuming you entered "Jim" into the Namefield?

===== end =====

-- Rachel Holmen, Berkeley, CA, USA, registered user of Pocket C and Pocket C Architect
-- Rachel Holmen, Berkeley, CA, USA, registered user of Pocket C and Pocket C Architect
Posts: 1
Joined: Sun Jul 16, 2006 3:28 am
Location: USA

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest