Forum Archive

Disable sub view = disable object in it automatically?

sendog3c

I want to disable a sub view, if I do that automatically all the buttons, textfield will be disable too.

Thanks.

mikael

@sendog3c, this seems to work:

view.objc_instance.setEnabled_(False)

... although the contained elements do not show the visual cues of being disabled (e.g. greyed-out text), so there is little practical difference to just setting:

view.touch_enabled = False

If the visual cues are important to you, I suggest writing a little utility function that loops through the subviews of a view and sets the value of the enabled property, if it exists (use hasattr), or touch_enabled otherwise.

sendog3c

Thank you Maikel let me to digest it 🤭🤭🤭😂😂😂😂😂, before implement