dagUnlinkParentFromChild
dagUnlinkParentFromChild(w_arc) =>t / nil
Description
Unlinks a parent node from a child node. It takes, as its only argument, the dagArc that connects the parent to the child. The arc is destroyed; however, neither the parent node nor the child node is destroyed. This can be useful if you want to change the parent of a node.
Argument
Values Returned
Examples
Use this example to visualize a graph by using DAG functions.
myClass= dagCreateClass("myClass") ; create class
myClass->displayList = dlMakeDisplayList(2)
dlAddBox(myClass->displayList 12 10:10 100:100)
dlAddBox(myClass->displayList 14 30:30 80:80)
myClass->pen = 1
person1= dagCreateNode("Person1" myClass) ; create nodes
person2= dagCreateNode("Person2" myClass)
person3= dagCreateNode("Person3" myClass)
person1->textColor = hivForegroundColor ; avoid erase in rubberbanding
person2->textColor = hivForegroundColor
person3->textColor = hivForegroundColor
person1->label = "p1label"
person2->label = list( "p1l1" "p1l2" )
dagLinkParentToChild(person1 person2) ; link nodes together
dagLinkParentToChild(person1 person3)
procedure(main()
tool = dagOpenTool(hivEditorBackgroundColor
list(180:150 450:550) ; x1,y1 x2,y2
person1 ; starting node
"DAG example" ; win title
"dagHelpSymbol") ; help symbol
tool->textOnly = nil ; use text mode only; display list core dumps
tool->showLabels = t
tool->labelJustification = 'lowerLeft
dagAddActionToObject( ; add accelerator a on nodes
'("Print_Hello" "println" "\"Hi, I am in func hello\"" "a" t)
myClass
)
dagAddActionToObject( ; add accelerator b on nodes
'("Print_object_name" "printObj" "dagGetCurrentObject()" "b" t)
myClass
)
dagAddActionToObject( ; add accelerator c on nodes
'("Print_M1" "println" "\"message 1\"" "c" t)
myClass
)
dagAddActionToObject( ; add accelerator d on nodes
'("Print_M2" "println" "\"message 2\"" "d" t)
myClass
)
dagAddActionToObject( ; add accelerator e on nodes
'("Print_M3" "println" "\"message 3\"" "e" t)
myClass
)
dagAddActionToObject( ; add accelerator f on nodes
'("Print_M4" "println" "\"message 4\"" "f" t)
myClass
)
dagAddActionToObject( ; add accelerator g on nodes
'("Print_M5" "println" "\"message 5\"" "g" t)
myClass
)
dagAddActionToObject( ; add accelerator MMB on nodes
'("Print_MMB" "println" "\"click MMB\"" "mouseMiddle" t)
myClass
)
dagAddActionToObject( ; add accelerator MMB2 on nodes
'("Print_MMB2" "println" "\"double click MMB\"" "mouseMiddle2" t)
myClass
)
dagAddActionToObject( ; add accelerator RMB on nodes
'("Print_RMB" "println" "\"click RMB\"" "mouseRight" t)
myClass
)
dagAddActionToObject( ; add accelerator RMB2 on nodes
'("Print_RMB2" "println" "\"double click RMB\"" "mouseRight2" t)
myClass
)
)
procedure(printHello(buf) ; called from accelerator a on nodes
printf("got message -%s-\n", buf)
)
procedure(printObj(node) ; called from accelerator b on nodes
printf("got node -%s-\n", node->name)
)
prefix= "DAG example"
hiRegisterBindKeyPrefix(prefix "browser") ; register bind key table
hiSetBindKey(prefix "None<Btn1Down>" "startBox()")
hiSetBindKey(prefix "None<Btn1Down> EF" "getBoxPoint()")
hiSetBindKey(prefix "None<Btn2Down>" "keyFunc2()") ; do bind keys
hiSetBindKey(prefix "None<Btn3Down>" "keyFunc3()")
; called when left mouse button is pressed inside the enter function
procedure(getBoxPoint()
addPoint(hiGetCommandPoint())
)
procedure(boxDone(w done pts) ; called when enter function for box is done
if( done then
printf("box entered was %L \n" pts)
else
println("Box entry aborted\n")
)
)
; called when left mouse button is pressed and not in enter function
procedure(startBox()
enterBox(?doneProc "boxDone"
?prompts '("enter 1st point for box" "enter 2nd point for box")
)
)
procedure(keyFunc2() ; called when middle mouse button is pressed
println("got middle mouse button")
)
procedure(keyFunc3() ; called when right mouse button is pressed
println("got right mouse button")
)
Related Topics
Return to top