ADC Home > Reference Library > Technical Q&As > Carbon > Human Interface Toolbox >

My ListBox control works fine on Mac OS X but I get a crash on Mac OS 9 when I click in the scrollbar


Q: My ListBox control works fine on Mac OS X but I get a crash on Mac OS 9 when I click in the scrollbar. What's happening?

A: In order for the ListBox control to work correctly, the control's owner window needs to have a root control. If the control's owner window doesn't have a root control, then, indeed, you will get a crash or a non-working scrollbar, depending on the value of the actionProc passed in your calls to TrackControl or HandleControlClick. If a root control has been established (CreateRootControl(...)), then everything will work as expected.

Carbon on Mac OS X always creates a root control by default when it creates the window. You can safely call CreateRootControl on Mac OS X; it's harmless and won't create a double root control. For a complete example, look at the SimpleList sample code in the Human Interface Toolbox category.


[Jul 12 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.