Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Prevent Deletion of Flowchart Object (Read 2423 times)
mjweyland
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Apr 2nd, 2007
Prevent Deletion of Flowchart Object
Apr 26th, 2007 at 11:47am
Print Post  
Is there a way to absolutely prevent an object from being deleted from a flow chart? 

I have some code on the key down event on the flow chart and this is stopping the event.  However, after the event is prevented if a user tries to multi-select nodes in a flowchart the object isn't selectable. 

Ironically enough this is the effect I hope to achieve. I want to prevent specific nodes from being multi-selectable on a flowchart but still want to allow a group of items from being deleted from a flowchart possible. 

Any suggestions is greatly appreciated.

_nodes is a collection object I use to management of the information back to the DB and _delete is a flag used on the deleting event.



Code
Select All
	  While (fcMain.Selection.Objects.Count > 0)
		Try
		    Dim _o As Object = fcMain.Selection.Objects(0)
		    If _o.GetType.Name = "Box" Then
			  'attempt to delete the item from the collection
			  _nodes.Remove(fcMain.Selection.Objects.Item(0))
		    End If
		    _delete = True
		    fcMain.DeleteObject(fcMain.Selection.Objects(0))
		Catch ex As Exception
		    _delete = False
		    fcMain.Selection.Objects.Remove(fcMain.Selection.Objects(0))
		End Try
end while
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Prevent Deletion of Flowchart Object
Reply #1 - Apr 26th, 2007 at 12:00pm
Print Post  
Hi,

Handle the BoxSelecting event and set e.Confirm = false to prevent users from selecting a box. Handle BoxDeleting to prevent them from deleting a box.

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


I love YaBB 1G - SP1!

Posts: 37
Joined: Apr 2nd, 2007
Re: Prevent Deletion of Flowchart Object
Reply #2 - Apr 26th, 2007 at 6:32pm
Print Post  
Already doing that.  That is what the _delete variable is handling.

after the e.confirm value has been set to _delete the event continues or aborts

If the event aborts the object then becomes unselectable.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Prevent Deletion of Flowchart Object
Reply #3 - Apr 26th, 2007 at 7:44pm
Print Post  
Instead of

fcMain.Selection.Objects.Remove(fcMain.Selection.Objects(0))

in the Catch block try setting

fcMain.Selection.Objects(0).Selected = false

or call

fcMain.Selection.RemoveObject(fcMain.Selection.Objects(0))

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