Happy Friday! Last week we looked at sliders and how to move and adjust a collection of sliders. This week, we will look at locking and resetting sliders when a material is deselected. First, I’m going to discuss how I start storyboarding and putting together a UI.
I like to connect the visual requirements with the code so I usually start by sketching out what I want the UI to look like. I think about the different features I want to incorporate and how to best control them in an interface. For example, for the randomizing curtain wall mullions plug-in I wanted to makes sure it was possible to randomly delete only the vertical mullions, only the horizontal mullions, or both. This lended itself well to a check box that activated each option and allowed users to customize their selection. Additionally, I knew I wanted to allow users to randomize the materials of the panels. This made me start thinking about sliders since you can easily see the ratio of each material you have selected. Then I added additional layers for more control like the lock option.
When selecting materials for your curtain wall, it is possible you may want to lock one material to a certain percentage and then adjust the rest of the sliders to adjust the ratio. This is why I have added a check box to lock a slider. When the lock is checked, we have the chk_sliderLock_Checked event handler that sets the slider and input box to be inactive. It then also ensures the value of the locked slider isn’t changed when our other sliders are updated. We have a second event handler that sets everything active again when we uncheck the box.
One additional item we need to consider is what happens when a slider was set to a material and the user changes it back to “none”. In this case, we want to make sure the slider amount is redistributed to any active sliders and that the slider with no material selected is set to be inactive. This is exactly what our cwPanelType_SelectionChanged method does when the material selection is set to “none”.
And that wraps up the Curtain Wall Randomizer plug-in. You can download the compiled DLL on my GitHub repo. Next week, I’ll start a new series where I start to explore some of API related to text.