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 - pass pointer of Preferences structure to gadget
Page 1 of 1

PostPosted: Tue Jan 07, 2003 6:21 pm
by kac
I am having trouble passing a pointer of my preferences structure to a gadget. Run into trouble with the type in the parameter list.

Can anyone give an example of the correct syntax?

PostPosted: Wed Jan 08, 2003 12:47 am
by design4use
One possible cause for problems is that global (app scope) variable are not seen by the template code that defines the gadget. However an code related to an instance of that gadget on a form can 'see' the variable. But in order to help you you really need to be more specific in describing your case.

PostPosted: Wed Jan 08, 2003 11:45 am
by kac
Thanks for your response design4use,

I'll try to be brief but provide more info....

I define my preferences and create an instance appPrefs. I define a pointer to this instance pappPrefs using AppPrefs* pappPrefs=&appPrefs.

When I try to define a function parameter to pass this pointer it requires a type definition. It will not accept struct* as the type, typeof(&appPrefs) doesn't work. I'm not sure what type to use for the pointer variable I want to pass.

PostPosted: Thu Jan 09, 2003 5:16 am
by jims
Won't this work?

void funcName ( AppPrefs* funcAppPrefs );

PostPosted: Thu Jan 09, 2003 11:35 am
by kac
Jims,

The code looks like this:
void myGadget.ondraw(AppPrefs* pappPrefs)

The error I get when trying to build is:
MyGadget.oc(24 ): type name expected

I think the problem is the function is inside a Gadget vs. in a normal source file. Perhaps even that the Gadget source comes before the regular source files (I'm not sure).

I can pass references to structures within normal source of a program, the Gadget cannot see global variables.

The help in Orbforms defines the different pointer types and lists struct* as one of them, however the build gives an error when you define struct* as a parameter of a function. This is where I am confused.

I noticed in the PocketC forum this subject discussed and the moderator stating that PocketC does not support structure pointers. I would assume the same for Orbworks except in the help text for Pointers it specifically mentions struct* as a type. This is an exert from the help on pointers --- <i><b>"A pointer can be used with only one value type (int, string, struct, etc.)"</b></i>
kac

PostPosted: Thu Jan 09, 2003 9:15 pm
by cao
* Gadget files are compiled before the rest of files.
* If you defined an object let us call apppref in an .oc file, and
declared a method in your gadget file that takes this appref.
The compiler will complain since it processes the gadget file first, and it doesnot know the type of apppref yet.

You can try to move apppref code into gadget file, and see if that solved problem.

Usually I would recommend to keep gadget method generic and it will help you move this gadget around in different apps. If the gadget takes special objects as inputs, it would make it difficult to reuse it later.

PostPosted: Fri Jan 10, 2003 11:32 am
by kac
Cao,

Thanks for the response. I can pass a pointer to the individual field (I think) and solve it this way.

kac