Opened 21 months ago

Last modified 19 months ago

#18289 new enhancement

Can't nest modal dialogs using B_MODAL_SUBSET_WINDOW_FEEL and AddToSubset

Reported by: memecode Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Interface Kit Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

What I’d like is to be able to nest modal windows:

auto A = new BWindow(…) // Main app window
A->Show()

auto B = new BWindow(…) // First dialog
B->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL)
B->AddToSubset(A)
B->Show()

auto C = new BWindow(…) // Second dialog
C->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL)
C->AddToSubset(B)
C->Show()

But in this case, C doesn’t appear when I call Show. If I remove all the SetFeel/AddToSubset calls the dialogs all show up. The api should allow for arbitrarily deep nesting of modal dialogs.

Change History (5)

comment:1 by waddlesplash, 21 months ago

Component: - GeneralKits/Interface Kit

What's the return value of the last AddToSubset?

comment:2 by memecode, 21 months ago

First returns 0, second call returns -2147483643.

comment:3 by waddlesplash, 21 months ago

That's EINVAL / B_BAD_VALUE. It appears this is a documented limitation: https://www.haiku-os.org/docs/api/classBWindow.html#ac2abecfda66af23ee5e944530ce69c97

"window is not B_NORMAL_WINDOW_FEEL". So, you can't add windows to the subset of other modal windows.

Not sure why that is. A limitation we inherited from BeOS, I suppose?

comment:4 by memecode, 21 months ago

So maybe this is more of an enhancement than a bug. Nevertheless it's something that app developers want to do and seems reasonable to me.

I wonder if I temporarily change the feel of the parent to B_NORMAL_WINDOW_FEEL and then to B_MODAL_SUBSET_WINDOW_FEEL after AddToSubset... hmmm. Maybe the second SetFeel will fail in a similar fashion.

comment:5 by pulkomandy, 19 months ago

Type: bugenhancement
Note: See TracTickets for help on using tickets.