Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ShapeListBox Add and Remove (Read 4030 times)
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
ShapeListBox Add and Remove
Sep 8th, 2009 at 1:32pm
Print Post  
Hello,

I would like to know how I can programatically remove all shapes from the ShapeListBox and add a select few.. for example, RoundRect.

Moreover, I would like to add a custom one as well but I'm not sure how to proceed...

I tried :
shapeList.ShapeFilter.Clear()

But I don't think this is right. If this can't be done in ASP.NET, then maybe in Javascript?

Thanks !
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeListBox Add and Remove
Reply #1 - Sep 8th, 2009 at 3:07pm
Print Post  
Hi,

You could run the ShapeDesigner, delete all shapes you don't need, and save the remaining ones to a shape library file. Then set the listbox.ShapeLibraryLocation property to the shape-library URL.

If you are using JavaApplet mode, you could indeed use the ShapeListBoxApplet API to set the shapes from JavaScript. Doing that from the server is not supported yet.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
Re: ShapeListBox Add and Remove
Reply #2 - Sep 8th, 2009 at 3:11pm
Print Post  
Would it be possible to get a code sample in VB.NET for the ShapeDesigner, especially to delete, selectively add and add custom shape?

Thank you.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeListBox Add and Remove
Reply #3 - Sep 8th, 2009 at 3:19pm
Print Post  
ShapeDesigner is a tool you can launch from the start menu for NetDiagram. It displays a list of all predefined shapes - you can select and delete the ones you don't need from that list.
  
Back to top
 
IP Logged
 
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
Re: ShapeListBox Add and Remove
Reply #4 - Sep 8th, 2009 at 6:40pm
Print Post  
Thanks, I didn't know about it.

Now, would you have code samples on how to add and remove shapes from the ShapeListBox using VB.NET?

Here's what I tried (unsuccesfully):

shapeList.ShapeFilter.Clear()
shapeList.ShapeFilter.Add(Shapes.Rectangle.ToString)

Thank you.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeListBox Add and Remove
Reply #5 - Sep 9th, 2009 at 3:39pm
Print Post  
You can't modify the ShapeListBox on the server side when in JavaApplet mode, so that won't work from VB.NET. You could do that from JavaScript, e.g. in response to the AppletStartedScript event:

Code
Select All
var shapeListApplet = <%= shapeList.AppletElement %>;
var shapeList = shapeListApplet.getShapeListBox();
var scriptHelper = shapeListApplet.getScriptHelper();
var shape1 = scriptHelper.shapeFromId("Rectangle");
var shape2 = scriptHelper.shapeFromId("RoundRect");
shapeList.clearShapes();
shapeList.addShape(shape1);
shapeList.addShape(shape2);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint