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 - Draw Object Sample Code

Draw Object Sample Code

Discuss and publish sample code and applications written in OrbC (OrbForms Designer or PocketC Architect)

Postby jfield on Sat Jan 04, 2003 8:24 pm

Below is a example that I created to learn the Draw method syntax:

handler mainForm.onopen() {
// Draw Example
Draw draw; // Create an object to process the Draw methods

// Declare some variables to use for color index values
int whiteIndex, redIndex, greenIndex, blueIndex, blackIndex;
whiteIndex = draw.indexFromColor( 0, 0, 0);
redIndex = draw.indexFromColor(255, 0, 0);
greenIndex = draw.indexFromColor( 0, 255, 0);
blueIndex = draw.indexFromColor( 0, 0, 255);
blackIndex = draw.indexFromColor(255, 255, 255);

draw.attachForm(mainForm); // Attach the Draw object to a form
draw.begin();
draw.fg(redIndex); // Set the Foreground Color to RED
draw.bg(blueIndex); // Set the Background Color to BLUE
draw.textColor(greenIndex); // Set the Text Color to GREEN
draw.font(fntBold); // Set the Text Font to BOLD
draw.textAlign(22); // Set the Text Alignment to Bottom Right
draw.underline(ulDot); // Set the Text Underlining to Dotted
draw.line(clrFG,0,50,90,50); // Draw a RED Horizontal Line 90 pixels long
draw.line(clrFG,90,50,90,80); // Draw a RED Vertical Line 30 pixels long
draw.pixel(clrFG,45,45); // Draw a RED dot (i.e. a single point)
draw.rect(clrFG,0,15,30,45,0); // Draw a RED Square of 30 pixels
draw.fg(blueIndex); // Change the Foreground Color to BLUE
draw.rect(clrFG,45,15,75,45,15); // Draw a BLUE Circle of 30 pixels
draw.rect(clrFG,10,55,80,65,0); // Draw a BLUE Rectangle 70 pixels long
draw.rect(clrFG,10,70,80,90,10); // Draw a BLUE Rounded Rect. 70 pixels long
draw.frame(clrFG,10,95,50,135,0,1);// Draw a Frame
draw.end();
}
jfield
 
Posts: 43
Joined: Sun May 13, 2001 1:36 am
Location: USA

Postby orbFan on Fri Sep 30, 2005 10:20 pm

Thanks for the source code. This is very helpful for newbies like me.
orbFan
 
Posts: 21
Joined: Thu Sep 08, 2005 8:02 am
Location: Philippines

Postby MN OrbUser on Wed Feb 01, 2006 4:57 pm

I tried the following code and get this message, with the cursor at the start of Draw which is on line 10. What am I missing?

handler mainForm.onopen() {
fldResult.text = "";
Draw Registers;
Registers.attachForm(mainForm);
Registers.begin();
Registers.fg(16);
Registers.frame(1,7,21,39,32,3);
//frame(1,45,21,77,32,3);
//frame(1,83,21,115,32,3);
//frame(1,121,21,153,32,3);
Registers.end();
}

Complile Error
undeclared identifier
C:\Program Files\PocketC Architect\samples\Q Calc\mainform.oc @ 10
MN OrbUser
 
Posts: 12
Joined: Wed Feb 01, 2006 4:52 pm
Location: USA

Postby fabian1131 on Thu Feb 02, 2006 5:24 pm

Hey, it gives you that message because you must declare the pointer in the beginning. Your code must look like this:

handler mainForm.onopen() {

Draw Registers; //i swapped this line with:
fldResult.text = ""; //this

Registers.attachForm(mainForm);
Registers.begin();
Registers.fg(16);
Registers.frame(1,7,21,39,32,3);
//frame(1,45,21,77,32,3);
//frame(1,83,21,115,32,3);
//frame(1,121,21,153,32,3);
Registers.end();
}

++ Vielen Dank dass Sie meinen Post lesen++
++ Thank you for reading my post ++
++ Merci beaucoup pour lire ma poste ++
++ Grazie per lettura del mio messaggio ++
++ Vielen Dank dass Sie meinen Post lesen++
++ Thank you for reading my post ++
++ Merci beaucoup pour lire ma poste ++
++ Grazie per lettura del mio messaggio ++
fabian1131
 
Posts: 91
Joined: Mon Jun 14, 2004 4:45 pm
Location: South Africa

Postby MN OrbUser on Fri Feb 03, 2006 3:01 pm

Thank you, that got me by the first hurdle.

Now it compilies, but I get the following message out of the emulator:
OrbFormsRT(3.0.4) just read from memory location 0x80000020. This access usually indicates that the application is calling a Window Manager function without first establishing a valid DrawWindow.

I then tried jfield's sample code at the start of this topic and got the same message. I must still be missing something. These things can be so picky sometimes <G>.
MN OrbUser
 
Posts: 12
Joined: Wed Feb 01, 2006 4:52 pm
Location: USA

Postby MN OrbUser on Fri Feb 03, 2006 8:17 pm

I thought it might help if people had an idea of what I'm trying to do, because that might be part of the problem. I am programming a calculator for quaternions (successfully done for PocketC, but having trouble converting it to PocketC Architect). Quaternnions are like complex numbers but have 4 components instead of 2. Below is a rough schematic of the screen in ASCII. The space to the right of the title (Q Calc) is a UIField to hold the number being entered by tapping on the digits on the keypad below. The two rows of 4 boxes (because each quaternion has four components) in the middle are also UIFields and will hold the components of each quaternion as they are entered. The numeric keypad and function keys are UIButtons. So far the whole thing is one Form. In the PocketC version, the boxes in the middle are drawn with "frames". Currently the program works and the numbers go into the middle section. What I am trying to do is put "frames" around the numbers (different colors for each row, so as to indicate that those numbers in the same color boxes are related). Could the problem be that I can't "draw" in the middle of a Form? Will I need to define one Form for the top row and a different Form for the bottom half, and then define a drawing window for the middle? How would the UIFields get put in the drawing window?

***********************
*Q Calc |__| *
* ____ ____ ____ ____ *
* |__| |__| |__| |__| *
* *
* ____ ____ ____ ____ *
* |__| |__| |__| |__| *
* *
* 7 8 9 - sin *
* 4 5 6 + cos *
* 1 2 3 * exp *
* 0 . / log *
***********************

I hope this clafifies the problem and helps someone see a solution.
MN OrbUser
 
Posts: 12
Joined: Wed Feb 01, 2006 4:52 pm
Location: USA

Postby nmc on Fri Feb 03, 2006 9:27 pm

> OrbFormsRT(3.0.4) just read from memory
> location 0x80000020. This access usually
> indicates that the application is calling
> a Window Manager function without first
> establishing a valid DrawWindow.
Dont draw in the onopen() handler.
In your case, the drawing should be done in ondraw()
nmc
 
Posts: 197
Joined: Tue May 27, 2003 8:42 pm
Location: Germany


Return to OrbC User Samples

Who is online

Users browsing this forum: No registered users and 2 guests

cron