I have a button type which is a canvas in a ContainerControl. These buttons are instantiated in code and then I use EmbedWithin() to locate them within a buttonbar which is itself a ContainerControl.
Now, in normal use the user clicks the buttons to see different things in the main window. But I’d like a different mode where the user can drag/drop the buttons on the bar to rearrange them, and in this mode, clicking the buttons should have no effect. This would require having a state property that all buttons (in their mouseDown handler, for example) have access to. I’ve done this for one bar by creating a state property at the app-level, but it seems to me that this property really belongs in the bar itself. What I can’t figure out is the right syntax to use within the button’s mouseDown handler to access it.
I’ve tried such as self.parent.mystatevar but everything I try just gives a compiler error. What should I be doing?
only previously I was trying to call a method on the bar rather than access one of its properties. Trouble with getting old is, I forget that I’ve already solved what looks like a new problem in a slightly different context.