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
Page 1 of 1

PostPosted: Mon Sep 16, 2002 11:44 am
by Red_as_blood
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....

PostPosted: Mon Sep 16, 2002 12:40 pm
by PenreeSoft
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

PostPosted: Tue Sep 17, 2002 8:55 am
by Red_as_blood
Thank you for the code but i can't compile it!:( it gives errors and says that some variables are not been declared...

PostPosted: Tue Sep 17, 2002 1:13 pm
by wolfgang
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

PostPosted: Tue Sep 17, 2002 3:41 pm
by Red_as_blood
Yes i have a Pocketpc you know how could i do istead?

PostPosted: Tue Sep 17, 2002 9:51 pm
by goodey
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

PostPosted: Wed Sep 18, 2002 6:05 am
by Red_as_blood
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!!!!!!!!!!!!

PostPosted: Wed Sep 18, 2002 10:53 am
by guy
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