Hello All!
I see there's no feature of putting limit for the Split Container, where it can be designed so that the user can have split container no smaller than certain % or larger than certain %.
Is this achievable is some other way?
Thank you!
Hello All!
I see there's no feature of putting limit for the Split Container, where it can be designed so that the user can have split container no smaller than certain % or larger than certain %.
Is this achievable is some other way?
Thank you!
You could put a change script on the property which sets the handle back to some limiting value if it is dragged beyond the limiting value. Note that this doesn't prevent a user from dragging beyond the limit - it only places the handle of the split container back at the limit location whenever the value is re-calculated.
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
if currentValue:
current = float(currentValue.value.rstrip("%"))
limit = self.custom.limit
if current - limit <= 0:
self.props.split.position = str(limit) + "%"
elif current + limit >= 100:
self.props.split.position = str(100 - limit) + "%"
The limit property in this example is understood to be in "percent". As you've supplied a value of 100, your script is going to have issues as EVERY value would be an offending value.
I think your first screenshot's if statements after the 1st if statements require to be further indented.
... At least to my knowledge Python is sensitive to it.
Using the code from the latest screenshot, you should see the handle go "back" to the 10% mark if you drag it all of the way to the left (or really anywhere left of 10%). If you drag it right you will see no effect.