Opened 9 years ago

Closed 9 years ago

#12196 closed bug (fixed)

When setting the label of a BTab, the BTabView's tab bar is not invalidated

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

Description

As in title.

The BTab object has no way of knowing what BTabView it's currently in, and thus no way of calling Invalidate(). So I'm not sure what the proper solution to this problem is.

Change History (15)

comment:1 by axeld, 9 years ago

The proper solution for now is to document that you have to call BTabView::Invalidate() manually after having updated the title (and eventually InvalidateLayout(), too, right?).

Once we replace the interface kit with something amazing, we could also look into this issue again :-)

comment:2 by waddlesplash, 9 years ago

Is there a reason we can't make the BTab call Invalidate?

comment:3 by pulkomandy, 9 years ago

tab->View()->Parent()->Invalidate()?

in reply to:  2 comment:4 by axeld, 9 years ago

Replying to waddlesplash:

Is there a reason we can't make the BTab call Invalidate?

I just trusted your judgement that it has no way of knowing its BTabView. Apparently, I shouldn't have done that.

comment:5 by waddlesplash, 9 years ago

I just trusted your judgement that it has no way of knowing its BTabView. Apparently, I shouldn't have done that.

No, my judgement is correct, and PulkoMandy's isn't. The reason is that there are two forms of BTabView (as far as I can tell): the BCardLayout version, and the non-BCardLayout version. The code is a bit convoluted, but in the non-layout version, when BTabs are not the "current tab", they aren't actually a child of the BTabView at all -- they're technically parentless. And when adding a BTab to a BTabView, the BTabView does not pass a pointer to itself to the BTab, so there are at least some cases where the BTab cannot get the BTabView via ->Parent() chains.

So we can solve the problem by:

  • getting rid of the non-layout version (I can't tell what it's used for, exactly)
  • making BTabView call a hook function to give BTab its address
  • adding some other way for BTab to get the BTabView it's a part of

I don't know which is the correct solution, which is why I opened this ticket rather than just implementing something.

comment:6 by axeld, 9 years ago

Ah, sorry! The non-layout version obviously cannot be removed, as it is part of the Be API.

Can't we just solve the issue for the layout version, and leave the original version as is, and just document the fact? I wouldn't put much work into that, as the issue exists since almost 20 years for the original version of BTabView, when it can be easily solved for the layout version of it.

comment:7 by pulkomandy, 9 years ago

Does it work in BeOS? If so, we should make it work too, otherwise, we should just document it.

comment:8 by waddlesplash, 9 years ago

Well, one of the solutions (pass the BTab a pointer to the BTabView) will work both on layout and non-layout, so unless you see a reason not to use that one, that's the one I'd pick.

comment:9 by axeld, 9 years ago

If the solution that Adrien suggested works with the layout version, I'd use this, as it almost doesn't require any changes. That's only if the bug existed on BeOS, too (as I would expect) -- for existing software using the non-layout version, they will have worked around that bug already, anyway.

comment:10 by waddlesplash, 9 years ago

I seem to recall trying that solution on a BTabView that was part of a layout, so I don't know why it wouldn't've worked, but I don't think it did. Anyway, I don't have any BeOS installs that work, so if someone with a BeOS install could please test this, that'd be excellent.

comment:11 by pulkomandy, 9 years ago

Do you have a test program I can easily run? I can write one myself, but if you already have one it would help. And we can add it to our test suite.

comment:12 by markh, 9 years ago

Is this in anyway related to #12108? I added a test case for that which works on BeOS R5.

comment:13 by waddlesplash, 9 years ago

Yes, they have the same root cause: the BTab has no way of invalidating a BTabView.

Thanks for the tip, now we know that BeOS R5 does the right thing!

comment:14 by waddlesplash, 9 years ago

Owner: changed from axeld to waddlesplash
Status: newin-progress

comment:15 by waddlesplash, 9 years ago

Resolution: fixed
Status: in-progressclosed

Fixed in hrev49398.

Note: See TracTickets for help on using tickets.