PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

What is wrong with this simple example?

Dear All,

Just tried my first project with Visual PPL: the "for dummies" example. But after looking at it for a quarter or so, I gave up.

What's wrong? Anybody?

By the way:
+ what does #code {..} do?

Many thanks.

Marcel

Code:


#define FORM100 100
#define BUTTON101 101
#define MEMO102 102

#code {test.frm#}

proc HelloWorld
t$=GetText(MEMO102$);
s$=t$ + "\n" + "Hello World!";
SetText(MEMO102$,s$);
end;


#code {test.frm#FORM100}
func FORM100Proc (hWnd$, Msg$, wParam$, lParam$)
ok$ = true;
case(Msg$)
WM_COMMAND:
wmId$ = LOWORD(wParam$);
wmEvent$ = HIWORD(wParam$);
case(wmId$)
1001: // Exit
PostMessage(hWnd$, WM_CLOSE, 0, 0);
return(false);
101: // Button
HelloWorld;
end;
end;
return (ok$);
end;


#code {test.frm}
func WinMain
Global(FORM100$, BUTTON101$, MEMO102$, m1000$);


FORM100$ = NewForm("FORM100", "PPLForm", &FORM100Proc;);

BUTTON101$ = NewControl(101, "BUTTON", NULL, "BUTTON", WS_VISIBLE|WS_TABSTOP, FORM100$, 88, 208, 64, 24);

MEMO102$ = NewControl(102, "EDIT", NULL, "Click on the button", ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL, FORM100$, 32, 8, 176, 136);

list(keys$);
if (Count(keys$) > 0)
CreateAccelTable(FORM100$, keys$);
end;

m1000$ = NewMenu(FORM100$, "File", 1000);
NewMenuItem(m1000$, -1, "Exit", 1001);

ShowWindow(FORM100$, SW_SHOW);
SetForegroundWindow(FORM100$);

#code {test.frm#}

return (true);
end;

PointOfLight · 08 Mar 2005, 03:03 UTC
Could you be more specific as to what kind of error you're getting? I just copied everything from your sample, pasted it into a PPL file, and it ran just fine. As for the #code statement, it's better to let kornalius speak to this, but I believe it has to do with markings for the visual editor and how it relates the code to what you did visually in the editor.
zeeforel · 08 Mar 2005, 08:30 UTC — more specific
Eric (and Kornalius),

The code does run, but not as expected and explained in the "dummies tutorial". After tabbing the button the text box is supposed to show:

click on the button
Hello World

But only the first sentence is repeated (the proc HelloWorld isn't working correctly).

About the #code: can it be deleted?

Thanks
zeeforel · 08 Mar 2005, 09:53 UTC — Sorry, sorry
The code on the PPC differed from what I had on the PC. I thought there was some kind of automatic sync.

Sorry again but at least the code works!
PointOfLight · 08 Mar 2005, 12:39 UTC
That's what I don't understand. The Hello World function executed just fine for me. As for the code being different, it is and it isn't. When PPL compiles a program to run it on the PPC, it compiles the code and form into one module, which is what the #code and #form deliniations are for. Hopefully Kornalius will jump in here at some point so I'm not misspeaking, but I'm pretty sure that's what's going on. I'm not really sure why you're not seeing the results you'd expect from the program, though. It works just fine for me. Try creating a new PPL file (not a project), copying the code you pasted in this thread into the PPL file, and run it. Let us know if that works or not.
Hi,

The #code tag is an internal feature for the PIDE debugger to know which file and which component is being ran. Yes you can delete it, but it doesn't affect the program at all when running though.
zeeforel · 08 Mar 2005, 20:50 UTC — how does the PIDE actually work?
Dear All (there aren't many out here!)

...to continue my discussion...

I have installed PPL on the SD card in my PPC. Is this a problem for working with the PIDE, especially when working with the "project options"? There I have no possibility it seems, to point to the installation on the SD card. Am I right? If not, how to do it?

How does PPL install anyway? I found two parts on my PDA:
+ my documents\PPL\...files...
+ SD card\Arianesoft PPL\...files...

Is this correct like this?

All I want in the end to run from the PC on the PPC without any hassle. How to proceed?

Many thanks.

Best regards,
Marcel
PointOfLight · 08 Mar 2005, 21:45 UTC
Your path should be \SD Card\ and then whatever subdirectory you need. I've been able to run PPL just fine off of my CF Card, so I would think the SD Card would work pretty much the same.
Yep, set the default path for the PPL installation within the PIDE and then for every project you create do the same.

Go to File/Options and for each project go to Project/Options.
zeeforel · 09 Mar 2005, 09:39 UTC — OK!
Will try this tonight.

BTW: did you notice how the screen in this topic spans to a very wide resulution, probably due to the code inserted.

Marcel
Ok, it worked!!! Thanks