Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Pen events

Pen events

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

Postby Red_as_blood on Mon Sep 16, 2002 11:44 am

I am making a paint style program ad i can't figure out how to do a line like it was made with a pen.

i know that with the command waitp() you can wait for a pen event and with penx() and peny() popped in a variable you get the sreen coordinates...

know, i can i do to make a line just moving the stilus on the screen i just can't figure it out...

Could somebody help me....
Red_as_blood
 
Posts: 13
Joined: Sat Aug 10, 2002 2:06 pm

Postby PenreeSoft on Mon Sep 16, 2002 12:40 pm

Here is some source I got from Draw.pc:

<pre id="code"><font face="courier" size="2" id="code">
// Draw
int x,y;

draw() {
int e;

// Get initial position
x = penx();
y = peny();

// Draw lines until we stop receiving penMoves
do {
line(1, x, y, x=penx(), y=peny());
} while (event(1)==4);
}

main() {
int e;

graph_on();
title("Draw");
while (true) {
e = event(1);
if (e==2) draw();
}
str@[1] = '5';
}
</font id="code"></pre id="code">

Nicholas J. Penree
PenreeSoft
http://www.penreesoft.com
Nicholas J. Penree
PenreeSoft
http://www.penreesoft.com
PenreeSoft
 
Posts: 138
Joined: Sun May 26, 2002 8:14 pm
Location: USA

Postby Red_as_blood on Tue Sep 17, 2002 8:55 am

Thank you for the code but i can't compile it!:( it gives errors and says that some variables are not been declared...
Red_as_blood
 
Posts: 13
Joined: Sat Aug 10, 2002 2:06 pm

Postby wolfgang on Tue Sep 17, 2002 1:13 pm

This code is for the Palm version of PocketC. Are you using the PocketPC version of it? In this case you'll have to change the event handling. Also str@[1] (which accesses the second character of a string) does not exist in PocketC for WindowsCE. Use "strgetc (str, 1)" instead (even though the program never gets to that line of code...).

Wolfgang

Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby Red_as_blood on Tue Sep 17, 2002 3:41 pm

Yes i have a Pocketpc you know how could i do istead?
Red_as_blood
 
Posts: 13
Joined: Sat Aug 10, 2002 2:06 pm

Postby goodey on Tue Sep 17, 2002 9:51 pm

This works on the PocketPC.

<pre id="code"><font face="courier" size="2" id="code">
// Draw
int x,y;

draw() {
int e;
// Get initial position
x = penx();
y = peny();
// Draw lines until we stop receiving penMoves
do {
sleep(0);
line(x, y, x=penx(), y=peny());
} while (event(1)==2);
}

main() {
int e;

graph_on();
title("Draw");
while (1) {
sleep(0);
e = event(1);
if (e==4) draw();
}
}
</font id="code"></pre id="code">


Israel Vish
Israel Vish
goodey
 
Posts: 24
Joined: Wed Jan 17, 2001 10:34 pm
Location: USA

Postby Red_as_blood on Wed Sep 18, 2002 6:05 am

PERFECT!!
It's really what i wanted!!!!!!

I have another question...

If in a string variable i have a text is it possible to exporte it on a normal text file (like .txt) so if i open this file in my app it remember all my settings?
I know than you can use registy to do this but i don't want to mess it up... is it possible and could somebody show me?

Red_as_blood

PocketC FOR EVER!!!!!!!!!!!!
Red_as_blood
 
Posts: 13
Joined: Sat Aug 10, 2002 2:06 pm

Postby guy on Wed Sep 18, 2002 10:53 am

PocketC isn't very good at reading text files. It's good for writing them though. The problem is that there is no function to read a line from a file, so you have to write your own (read a block of text, search for the end of line, chop off the line, seek file to after place where end of line was).

If you want to save settings and restore them then the registry functions are easier to use than the file functions. You can read and write ints, and read and write strings. There's no reason why you should mess the registry up any more than messing the file system up. You're just writing to a thing with a name. You could equally well mess up by overwriting one of the windows system files using the file routines.

example to write data for your app:

<pre id="code"><font face="courier" size="2" id="code">


// Standard registry keys for program settings are stored in
// the user (1) part of the registry under "software".
// You should use your name or company name and the program
// name as part of the key:
//
// HKEY_CURRENT_USER\software\Your name\Your program\Settings
//
// would be a good choice. The use whatever name you want
// for each setting.


string sProvider = "Your name" ;
string sProduct = "Your program" ;
string sKey ;


sKey = "Software\\" + sProvider + "\\" + sProduct + "\\Settings" ;


regwstr(1, sKey, "MyParam", "Some string to save") ;
regwint(1, sKey, "AnotherParam", 15) ;


// Read it back


string sParam ;
int iParam ;


sParam = regrstr(1, sKey, "MyParam") ;
iParam = regrint(1, sKey, "AnotherParam") ;


</font id="code"></pre id="code">



Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron