Dan Baeckström wrote: > I would imagine that there is some way to keep tabs on an object such that it can be modified after it has been created and other objects have been dealt with in the meantime? Would that be CGPathRef? > > What I would like to try out is to make a series of simple objects (say filled circles) and then at some later timepoint remove any one of them without changing anything else. Not sure how inefficient this is, but another option is to create a user pane for each object (or group of objects). The following demo (submitted for amusement only) randomly hides/shows the panes and also adjusts their z-order. '--------------- include "Tlbx HIView.incl" include "Util_CE.incl" begin enum 1 _pane1 _pane2 _pane3 _pane4 end enum local fn MyControlDrawHandler( nextHandler as EventHandlerCallRef, theEvent as EventRef, userData as pointer ) '~'1 dim as CGContextRef ctx dim as long btn : btn = userData dim as OSStatus result : result = _eventNotHandledErr fn GetEventParameter( theEvent, _kEventParamCGContextRef, _typeCGContextRef, #0, sizeof( ctx ), #0, @ctx ) select ( btn ) case _pane1 CGContextSetRGBFillColor( ctx, 1.0, 0.0, 0.0, 0.8 ) CGContextFillRect( ctx, fn CGRectMake( 100.0, 100.0, 300.0, 300.0 ) ) case _pane2 CGContextSetRGBFillColor( ctx, 0.0, 0.0, 1.0, 0.4 ) CGContextFillEllipseInRect( ctx, fn CGRectMake( 150.0, 150.0, 200.0, 200.0 ) ) case _pane3 CGContextSetRGBFillColor( ctx, 0.0, 1.0, 0.0, 0.5 ) CGContextFillEllipseInRect( ctx, fn CGRectMake( 200.0, 200.0, 300.0, 250.0 ) ) case _pane4 CGContextSetRGBFillColor( ctx, 1.0, 1.0, 0.0, 1.0 ) CGContextFillEllipseInRect( ctx, fn CGRectMake( 50.0, 50.0, 150.0, 200.0 ) ) end select end fn = result local fn MyTimerHandler( theTimer as EventLoopTimerRef, userData as pointer ) '~'1 dim as ControlRef c c = button&( rnd( 4 ) ) long if ( fn HIViewIsVisible( c ) ) fn HIViewSetVisible( c, _false ) xelse fn HIViewSetZOrder( c, _kHIViewZOrderAbove, button&( rnd( 4 ) ) ) fn HIViewSetVisible( c, _true ) end if end fn local fn BuildWindow '~'1 dim as Rect r dim as WindowRef w SetRect( r, 0, 0, 600, 500 ) appearance window -1,, @r, _kDocumentWindowClass, _kWindowCompositingAttribute get window 1, @w appearance button _pane1,, _kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc fn CEAddEvent( _kEventClassControl, _kEventControlDraw ) fn CEInstallControlEventHandler( button&( _pane1 ), @fn MyControlDrawHandler, _pane1, 0 ) appearance button _pane2,, _kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc fn CEAddEvent( _kEventClassControl, _kEventControlDraw ) fn CEInstallControlEventHandler( button&( _pane2 ), @fn MyControlDrawHandler, _pane2, 0 ) appearance button _pane3,, _kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc fn CEAddEvent( _kEventClassControl, _kEventControlDraw ) fn CEInstallControlEventHandler( button&( _pane3 ), @fn MyControlDrawHandler, _pane3, 0 ) appearance button _pane4,, _kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc fn CEAddEvent( _kEventClassControl, _kEventControlDraw ) fn CEInstallControlEventHandler( button&( _pane4 ), @fn MyControlDrawHandler, _pane4, 0 ) window 1 fn CETimerInstall( 0, 2.0, 1.0, @fn MyTimerHandler, 0 ) end fn fn BuildWindow() RunApplicationEventLoop() '--------------- Bernie