[haiku-development] Re: Issues customizing BTabView

  • From: Kacper Kasper <kacperkasper@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 15 Apr 2018 19:09:14 +0200

2018-04-15 18:44 GMT+02:00 looncraz <looncraz@xxxxxxxxxxxx>:

Do you need to actually use the view name or a string?  Could you convert
the object's memory address to a unique identifier for your purposes?

Yes, as I said Yab uses names to reference views, not only internally
but also in scripts.

Example:
VIEW 0,0 TO 400,320, "BackgroundView","MainWindow"
TABVIEW 5,2 TO 395,300, "Test", "top", "BackgroundView"
  TABVIEW ADD "Test",  "Tab1"
    BUTTON 5,5 TO 105,25, "BT:Hui", "Hui", "Test1"
  TABVIEW ADD "Test",  "Tab2"
VIEW REMOVE "BackgroundView"

See the button creation: first tab's view gets "Test1" name, but when
BackgroundView is removed it's called "Tab1". As a result it's not
removed from the index and the list contains duplicates, which later
leads to returning destroyed views and crashes.

Theoretically I could add my own name to YabView class, but the code
is a mess and would need a lot of changes for that to work (and I
don't know what else will break).

Anyway, IMO messing with view's name is bad behavior, so I'd prefer
solution 1. I'm not sure if it doesn't break something though, hence
the question.

Kacper

Other related posts: