Hello:
How can I handle the new element event? I tried to do a custom state but it does not give me this event. I need to know when a element is added to give it a new name and store its properties and I would like to have the element selected event to show its properties in a grid. It is posible?
Thanks
new element
Moderators: Frank Hileman, Anne Szyjan
- Frank Hileman
- Site Admin
- Posts: 1400
- Joined: Sun Jul 25, 2004 8:16 pm
- Location: California
- Contact:
Re: new element
Hello Laura,
When a new Element is added via the toolbox, the change is recorded as a DesignerTransaction by the Recorder service as an ElementAddition object. You can listen to these events by overriding PictureDesigner.TransactionCompleted. Call the base class implementation first.
To change the name of the a new object, instead of using the default naming algorithm, you will need to create a custom NameProvider service, replacing the usual one. There are three methods you need to override and it is a little complicated. We would need to provide a sample for you. What is the algorithm you wish to use?
When the selection changes, using any mechanism, the Selector service raises the SelectionChanged event. You can listen to this event, or override the SelectionChanged method on PictureDesigner (be sure to call the base class implementation).
Regards,
When a new Element is added via the toolbox, the change is recorded as a DesignerTransaction by the Recorder service as an ElementAddition object. You can listen to these events by overriding PictureDesigner.TransactionCompleted. Call the base class implementation first.
To change the name of the a new object, instead of using the default naming algorithm, you will need to create a custom NameProvider service, replacing the usual one. There are three methods you need to override and it is a little complicated. We would need to provide a sample for you. What is the algorithm you wish to use?
When the selection changes, using any mechanism, the Selector service raises the SelectionChanged event. You can listen to this event, or override the SelectionChanged method on PictureDesigner (be sure to call the base class implementation).
Regards,
Frank Hileman
http://www.vgdotnet.com
http://www.vgdotnet.com
- Frank Hileman
- Site Admin
- Posts: 1400
- Joined: Sun Jul 25, 2004 8:16 pm
- Location: California
- Contact:
Re: new element
Hello Laura,
I forgot to mention, you don't need to know when a new Element is added, to be able to change the name algorithm or show the selected object properties. There is an undo and a redo stack in the Recorder, so an Element may be added or removed as a result of undo and redo, as well as toolbox creation, or programmatically. The NameProvider and Selector should provide all you need to change the naming algorithm, or show selected object properties.
Regards,
I forgot to mention, you don't need to know when a new Element is added, to be able to change the name algorithm or show the selected object properties. There is an undo and a redo stack in the Recorder, so an Element may be added or removed as a result of undo and redo, as well as toolbox creation, or programmatically. The NameProvider and Selector should provide all you need to change the naming algorithm, or show selected object properties.
Regards,
Frank Hileman
http://www.vgdotnet.com
http://www.vgdotnet.com