[sedonadev] how to use linkEvent's link.toSlot to set a slot to NULL.

42 views
Skip to first unread message

keith bradley

unread,
Jun 20, 2017, 7:27:30 PM6/20/17
to sedo...@googlegroups.com
Hello Sedona peeps!

Inside the linkEvent call back I need to set a slot to it's default of null when a link is deleted.

I am given:

link.toSlot

... which is a byte ID.

How do I massage this to a Slot type in order to use the assignment:

mySlot := null



Thanks!



Mateusz Klatecki

unread,
Jun 21, 2017, 3:52:45 AM6/21/17
to sedo...@googlegroups.com
Hi,

why you don't use this method in Component?

setToDefault
public virtual void setToDefault(Slot slot)
Set property to a default value. Called when a link is removed from an input slot.

best regards


pozdrawiam
Mateusz 

--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.
To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.

keith bradley

unread,
Jun 21, 2017, 10:38:06 AM6/21/17
to sedo...@googlegroups.com
Thanks Mateusz ... the trick is to convert link.toSlot which is a byte id of the comp's slot ... to a type Slot.

... also ... it seems this should run anyway when a link is broken.
Doesn't seem to for me.

I set my input as null but when the link if deleted it remains true or false.

I am calling super.linkEvent(eType, link) ... I assumed I would have to.

Could this be messing things up?

Mateusz Klatecki

unread,
Jun 21, 2017, 4:17:29 PM6/21/17
to sedo...@googlegroups.com
I always use setToDefault method if I want to set own value after link delete :

class MyComp extends Component {
property bool in := null;

override void setToDefault(Slot slot) {
  super.setToDefault(slot);
  if (slot == MyComp.in) {
    in := null;
  }
}

if you want convert slot id to Slot use:

this.type.slot(slotId);



pozdrawiam
Mateusz 

keith bradley

unread,
Jun 21, 2017, 9:37:00 PM6/21/17
to sedo...@googlegroups.com
Thanks Mateusz !!
Reply all
Reply to author
Forward
0 new messages