Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Is there any way to add a delete button at the top of the node? (Read 7605 times)
developer
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 9th, 2013
Is there any way to add a delete button at the top of the node?
Jun 7th, 2013 at 2:41pm
Print Post  
Is there any way to add a delete button at the top of the node?
Something similar in style to delete applications on ios.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Is there any way to add a delete button at the top of the node?
Reply #1 - Jun 7th, 2013 at 4:06pm
Print Post  
You could custom-draw a delete icon using the approach shown here:
http://mindfusion.eu/Forum/YaBB.pl?num=1367227880/1#1

Then handle nodeClicked event and delete args.getNode() if you detect the mouse pointer is inside the icon bounds.

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


I Love MindFusion!

Posts: 16
Joined: May 21st, 2020
Re: Is there any way to add a delete button at the top of the node?
Reply #2 - May 21st, 2020 at 3:39pm
Print Post  
Are you still unable to create an actual button component in a composite node.  This post is 7 years old and I have not seen any other postings regarding this.


I have WinForms application using mindfusion and it has composite nodes using button components, I am trying to replicated that on the web using MVC version but modifying the Tutorial8 Sample code to have a ""Component"": ""Button"" seems to not be valid in MVC version is this true?  Do I really need to draw an image, create bounds, and check for mouse pointer within those bounds when a click even occurs? Like in the OrgChart Sample?  If so, when should/would I use the json  string template used in Tutorial8 vs the JS method used in OrgChart?

Thank you!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Is there any way to add a delete button at the top of the node?
Reply #3 - May 21st, 2020 at 4:17pm
Print Post  
CompositeNodes are available in MVC version since last year's 3.1 release and do not support any interactive components yet. We'll have in mind ButtonComponent for next release.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Is there any way to add a delete button at the top of the node?
Reply #4 - May 28th, 2020 at 8:54am
Print Post  
Attached script implements simple button components, with image, imageAlign and text properties so far (unlike Windows Forms where you can place other components as buttons' contents).

Code
Select All
@{
    string template = @"{
""component"": ""GridPanel"",
""rowDefinitions"": [""6"", ""*""],
""columnDefinitions"": [""6"", ""*""],
""children"":
[
{
""component"": ""Shape"",
""id"" : ""RoundRect"",
""columnSpan"": 2,
""rowSpan"": 2,
""margin"": ""2"",
""brush"": ""skyblue"",
""pen"": ""skyblue""
},
{
""component"": ""Text"",
""columnSpan"": 2,
""rowSpan"": 2,
""margin"": ""3,5,3,1"",
""text"": ""some node contents""
},
{
""component"": ""ButtonComponent"",
""gridColumn"": 0,
""gridRow"": 0,
""brush"": ""#ccc"",
""imageLocation"": ""../Content/close-all.png"",
""imageAlign"": ""Center"",
""cornerRadius"": 3.5,
""clickHandler"": ""onDeleteClick""
}
]
}
";

function onDeleteClick(sender, args)
{
    var item = args.getItem();
    item.getParent().deleteItem(item);
} 



Regards,
Slavcho
  

MindFusion_Diagramming_002.zip (Attachment deleted)
Back to top
 
IP Logged
 
DSI
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Joined: May 21st, 2020
Re: Is there any way to add a delete button at the top of the node?
Reply #5 - Jun 3rd, 2020 at 8:18pm
Print Post  
""component"": ""ButtonComponent"" doesn't seem like a valid component for MVC version.  As soon as I add this component to my node, the nodes do not load on screen.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Is there any way to add a delete button at the top of the node?
Reply #6 - Jun 4th, 2020 at 5:50am
Print Post  
Have you replaced diagramming.js in your project with one attached above? Maybe also refresh the browser page to make sure not using cached copy.
  
Back to top
 
IP Logged
 
DSI
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Joined: May 21st, 2020
Re: Is there any way to add a delete button at the top of the node?
Reply #7 - Jun 4th, 2020 at 7:40pm
Print Post  
I didn't replace diagramming.js.  This is now working, thank you very much!

Is there anyway to adjust the dimensions of the button?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Is there any way to add a delete button at the top of the node?
Reply #8 - Jun 5th, 2020 at 8:06am
Print Post  
For time being try something like this -

Code
Select All
{
""component"": ""ButtonComponent"",
""brush"": ""#ccc"",
""imageLocation"": ""../Content/close-all.png"",
""imageAlign"": ""Center"",
""cornerRadius"": 3.5,
""fixedWidth"": 6,
""fixedHeight"": 6,
""clickHandler"": ""onDeleteClick""
}

...
<script type="text/javascript">
    MindFusion.Diagramming.ButtonComponent.prototype.measure = function ()
    {
        this.desiredWidth = this.fixedWidth;
        this.desiredHeight = this.fixedHeight;;

        this.textContent.measure(this.fixedWidth, this.fixedHeight);
    };
</script> 



We'll extend the button for official release with some min/max properties and auto-sizing depending on text / image.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint