Now, the problem here is if this is a menu bar in the context of my MainWindow that this targets the Window, not the App. One way around this is to forward declare the item
item = new BMenuItem(B_TRANSLATE("About"), new BMessage(B_ABOUT_REQUESTED)));
item->SetTarget(myAPp);
.AddItem(item)
Or to add some case in MessageReceived() that forwards this to the app.
I think both cases are a bit ugly, and this is quite a common case.
Do you have an example of how your patch can be used?
I had assumed that this would be a new overloaded method for creating the item, but it seems your patch does something different. I also know the SetMarked function and such is often used in e.g StyledEdit, but there the BMenuItems are forward declared so they are a member of the class to later let the Mark status be set/unset
EDIT: it seems the previous “.SetEnabled” is used in Terminal (didn’t find it anywhere else)
One of the reasons I sat on that change without submitting was that I was thinking should I add same kind of convience functions to other things that send BMessages so the API would behave equally on different controls. What do you think about that? The other reason was just forgetting and not having time to work on Haiku stuff.