[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
VG.net Discussion • View topic - Newbie question on picture instance names

Newbie question on picture instance names

Anything other than problems and feature requests.

Moderators: Frank Hileman, Anne Szyjan

Newbie question on picture instance names

Postby LHuisingh » Wed Dec 12, 2012 2:17 pm

Larry Huisingh
LHuisingh
 
Posts: 20
Joined: Tue Dec 11, 2012 4:22 pm

Re: Newbie question on picture instance names

Postby Frank Hileman » Wed Dec 12, 2012 5:16 pm

Hello Larry,

Please check the *.Designer.cs file to see if the Name property values were correctly serialized. If SerializeNames is set to true, you should see the code setting the Name property values. If not set, the Name of an Element is the empty string.

Your code is exactly correct, except if you are trying to distinguish across Canvases, you may have duplicate names by design. Also, if you are detecting the event on a parent object, you will need to dig into the InputEventArgs.AffectedElements property, where you can access the whole stack. The first Element is the leaf, and the remaining are ancestors in order.

Regards,
Frank Hileman
User avatar
Frank Hileman
Site Admin
 
Posts: 1399
Joined: Sun Jul 25, 2004 8:16 pm
Location: California

Re: Newbie question on picture instance names

Postby Frank Hileman » Wed Dec 12, 2012 5:31 pm

Hi Larry,

OK thinking about this I have a theory. You are catching the event at the level of the component. It is a top-level Picture. The top-level Picture has a name, however it will always be the same, as it is not a sub-Picture. When you add it to a Canvas dynamically it's name does not change. In that case you need to set the Name explicitly in the code when you add it to the Canvas. Perhaps I am correct?

And the same diagnosis would be true for a dynamically added sub-Picture.

Regards,
Frank Hileman
User avatar
Frank Hileman
Site Admin
 
Posts: 1399
Joined: Sun Jul 25, 2004 8:16 pm
Location: California

Re: Newbie question on picture instance names

Postby LHuisingh » Thu Dec 13, 2012 8:22 am

I checked the *.designer.cs file and the .Name property is being set on the Sensor class.

Also, I am incorporating this Sensor component on another Picture which contains an image and a polygon or two. Finally, this Picture is placed on a canvas in a form. I imagine I will ultimately be having a few hundred pictures each with their own images, polygons and Sensor components.

I was able to access the InputEventArgs.AffectedElements collection. The only Name values I received were the generic names as created in the component design. Is there a way to give each instance of a component a name and a text value such that the Click method can do instance-specific actions? Likewise, I would like to have each instance of the component have a unique ImageFill. Is this possible?
Larry Huisingh
LHuisingh
 
Posts: 20
Joined: Tue Dec 11, 2012 4:22 pm

Re: Newbie question on picture instance names

Postby Frank Hileman » Thu Dec 13, 2012 9:51 am

Frank Hileman
User avatar
Frank Hileman
Site Admin
 
Posts: 1399
Joined: Sun Jul 25, 2004 8:16 pm
Location: California

Re: Newbie question on picture instance names

Postby LHuisingh » Thu Dec 13, 2012 10:25 am

I had set SerializeNames to true on the component level class. I had not set SerializeNames to true on the containing Picture. Once I did so on the Picture containing the instance of the component, the Click handler could correctly retrieve the name of the specific component instance. As it turns out, I may not even need SerializeNames turned on for the component if I only care about the instance-specific name as found on its containing Picture.

Learning as I go.
Larry Huisingh
LHuisingh
 
Posts: 20
Joined: Tue Dec 11, 2012 4:22 pm


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests

cron