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

PostPosted: Fri May 05, 2006 4:25 pm
by Tom Miller
One application that I'm trying to convert from PocketC (with extensive use of PToolbox) to OrbForms is a graphing app. After drawing an x-y grid (graph paper-style), and plotting some labelled data points, the user can perform several different functions, such as tap on the graph to draw a vertical line, then tapping on either side of the line to move the line pixel-by-pixel. Another function is to zoom in by tapping a dragging to define a zoom box.

To familiarize myself with OrbForms, I successfully implemented the tap-and-drag function, using the form's onpendown, onpenmove, and onpenup methods. But, how do I implement <i>all</i> the functions I need?

I thought the approach would be to use gadgets, thinking I could attach and detach different gadgets from the same form. (Like a zoom in gadget, and a vertical line gadget, etc.) Can this be done? I figured I'd use menu selection to change from one gadget to the other. But it looks like I only get one gadget per form.

Thanks,
Tom

PostPosted: Fri May 05, 2006 4:50 pm
by mgreen
You can declare gadgets, as many as you want in a form. Each gadget has its own methods. The description in the documentation is a bit minimal, but the major features are that: 1) You have to declare a structure for each gadget (unless they're identical in terms of internal data) with the first variable being a UIGadget. 2) You declare each gadget in a "gadget <type> <name> { ... }" declaration within a form where <type> is the structure type you've declared and <name> is the name of the object created (and used in <name>.onpen... declarations).

Here's my example:

struct earDrawing {
UIGadget gadget;
void onopen();
void ondraw();
void onpendown();
void onpenup();
void onpenmove();
Draw draw;
};
@form mainForm {
id = 3000; text = "AuriculoDoc";
x = 0; y = 0; w = 160; h = 160;
gadget earDrawing ear {
id = 3016;
x = 0; y = 18; w = 94; h = 140;
}
}

PostPosted: Fri May 05, 2006 5:56 pm
by Tom Miller
Thanks for the reply, mgreen. To be a little more specific about my problem, I guess what I need to do is have gadgets that overlap on the screen, and depending what "mode" the app is in (zoom in, vs. draw a vertical line), a pen tap on the screen is interpreted differently.

So, when the user selects "Zoom In" from the menu, then a tap on the screen is treated as selecting one vertex of the zoom box. If the user selects "Draw Line", then a tap on the screen draws a line there, and subsequent taps move that line.

Can I do this with gadgets?

Thanks again for your help,
Tom

PostPosted: Fri May 05, 2006 7:10 pm
by mgreen
You could hide all of the overlapping gadgets except the one that's active and the menu selections would switch which gadgets are shown. I believe that hidden object do not respond to pen events. Another option would be to use one gadget, but have a state machine that treats pen events differently in the gadget depending on the state (draw vertical line, move line, zoom in, etc.)

PostPosted: Sat May 06, 2006 6:22 pm
by Tom Miller
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by mgreen</i>
<br />You could hide all of the overlapping gadgets except the one that's active ...<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Oh, of course! I was looking for some way to attach/detach, but hiding is the way to do it.

Thanks mgreen!

Regards,
Tom