Re: Embed a custom HIView in HIScrollView?
Re: Embed a custom HIView in HIScrollView?
- Subject: Re: Embed a custom HIView in HIScrollView?
- From: Alex Curylo <email@hidden>
- Date: Tue, 18 Oct 2005 12:28:02 -0700
on 10/18/05 12:15 PM, email@hidden at
email@hidden wrote:
> In IB:
>
> - drag an HIView into the window
> - click on it so it gets selected
> - from the menu, select Layout : Embed in > ScrollView.
Can't do that with a custom view, dude. At least not last time I had to.
Sure be nice if they fixed that, wouldn't it?
What I ended up doing was making the custom view I placed in IB essentially
a place holder for creating a scroller and the actual view I wanted inside
it, like this:
OSStatus TContactsListHolder::Initialize(TCarbonEvent& inEvent)
{
TRect frame = Frame();
OSStatus status = TView::Initialize(inEvent);
require_noerr(status, CantInitializeParent);
// create scroller and embed -- Interface Builder won't allow this!
// create the scroller
status = ::HIScrollViewCreate(
kHIScrollViewOptionsVertScroll | kHIScrollViewOptionsHorizScroll,
&mScroller
);
require_noerr(status, CantCreateScrollView);
status = ::HIViewAddSubview(
GetOwnerContent(),
mScroller
);
require_noerr(status, CantCreateScrollView);
status = ::SetControlID(
mScroller,
&kContactsListScrollerControlID
);
require_noerr(status, CantCreateScrollView);
status = ::HIScrollViewSetScrollBarAutoHide(
mScroller,
true
);
require_noerr(status, CantCreateScrollView);
status = ::HIViewSetFrame(
mScroller,
&frame
);
require_noerr(status, CantCreateScrollView);
// create the list
status = TContactsList::Create(mList);
require_noerr(status, CantCreateListView);
status = ::HIViewAddSubview(
mScroller,
mList
);
require_noerr(status, CantCreateListView);
status = ::SetControlID(
mList,
&kContactsListControlID
);
require_noerr(status, CantCreateListView);
::HIViewSetVisible(mScroller, true);
::HIViewSetVisible(mList, true);
CantCreateListView:
CantCreateScrollView:
CantInitializeParent:
return status;
}
--
Alex Curylo -- email@hidden -- http://www.alexcurylo.com/
A computer without a Microsoft operating system
is like a dog without bricks tied to its head.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden