Deb Lake wrote:
> The old DataBrowser for Dummies had some great examples for custom drawn DB items. Could the new DB example be updated to include such, maybe just a colored circle in a cell. Comparing the old code with new, I'm lost to translate...
Install a kEventClassDataBrowser/kEventDataBrowserDrawCustomItem handler on the browser. In the handler, do something like:
'---------------
dim as HIViewRef browser
dim as CGRect cellRect
dim as CGContextRef ctx
dim as DataBrowserPropertyID propertyID
dim as DataBrowserItemID itemID
fn GetEventParameter( theEvent, _kEventParamDataBrowserPropertyID, _typeSInt32, #0, sizeof( propertyID ), #0, @propertyID )
long if ( propertyID == _kMyCustomColumnPropID )
fn GetEventParameter( theEvent, _kEventParamDirectObject, _typeControlRef, #0, sizeof( browser ), #0, @browser )
fn GetEventParameter( theEvent, _kEventParamCGContextRef, _typeCGContextRef, #0, sizeof( ctx ), #0, @ctx )
fn GetEventParameter( theEvent, _kEventParamDataBrowserItemID, _typeSInt32, #0, sizeof( itemID ), #0, @itemID )
fn GetEventParameter( theEvent, _kEventParamBounds, _typeHIRect, #0, sizeof( cellRect ), #0, @cellRect )
// draw circle
end if
'---------------
Bernie