• Here is a way to capture all notifications:
    https://github.com/jsbain/objc_hacks/blob/master/notification_capture.py

    This could be modified to observe a specific object, selector, etc. I believe there is a notification when a view is shown, but i didnt see an obvious one when the X is pushed.

    The confusing thing about what you are asking is that sheet is already basically modal, since it blocks anything else happening. in which case wait_modal might be what you want.

    For truly non-modal "windows", you might consider the Overlay, found here. This lets you create resizable views that float, and you can use connect to register actions that get called when the view is closed.

    Finally, it would be possible to delete the standard X, and replace it with your own button.

    v.objc_instance.superview().superview().superview().subviews()[1].subviews()[1]

    gives me the X button on ipad when presenting as sheet. This might be different on iPhone, and might be different if you have leftbuttonitems or rightbuttonitems defined.

    But this lets you, for instance, hide the default X, and define your own using right_button_items.

    v=ui.View() def c(sender): v.close() print('closed') v.right_button_items=[ui.ButtonItem(action=c,title='X')] v.present('sheet') v.objc_instance.superview().superview().superview().subviews()[1].subviews()[1].hidden=True
  • @omz , I would not have thought editor internal changes would have been the biggest issue. But you are the coder.

    However, I can imagine a nightmare supporting people's bad extensions or whatever they should be called.
    I am still not even close to understanding Python. But if via asserts or other mechanisms in the language you could be sure of the return types etc.. To make it rock solid... Just saying...
    Maybe the mechanism is more like the callback on layout etc...where you have more control. Just thinking out aloud really.

    I appreciate what you say about the possibilities with objc_util, but I am more of the school that don't roll your own if you don't have to. it's not about laziness or being scared. Just about conformity.

    Really, I like standards , interfaces etc... To write to when possible. Not to say innovation should be frowned upon, but for example you created the dialogs lib for a reason (sorry, have a new topic coming about dialogs), but it promotes a uniformity. A.K.A the first Macintosh toolbox.

    But at the end of the day, you know what is best for you and what is manageable, I respect that. I still have to say my little bit though 😘

Internal error.

Oops! Looks like something went wrong!