I am working with Eto Forms. My goal is to have an interactive dialog that allowed to rotate different objects in Rhino.
After creating a series of buttons with a for loop:
I wish for every button to perform a rotation on a different element when its click on. So I thought about creating a method that takes i from the for loop as argument, something like this:
Nevertheless I am running into several errors while trying this method. I am thinking that the functions for onclickactions are only limited to three arguments (self, sender, e). Is this correct? or is there another way to allow to add arguments.
You are creating num_elements buttons all in the same self.rotate variable. You should make self.rotate a list if you want to keep many numbers. But that still won’t help in the click handler.
Instead, you should look at sender, notself.rotate, in your click handler. That should be your Button, and will have the Tag property with the value you are looking for.