[futurebasic] badged icon problem in carbon and carbon classic

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2004 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <Waverly.Edwards@...>
Date: Tue, 10 Feb 2004 18:25:21 -0500

I want to place a badged icon in a picture field unfortunately there is a
strange ring that shows up around the caution or stop icons in the picture
that does not show up if you just plot the icon in the window - running
carbon

The caution and stop icons look horrible in carbon classic but does not have
the strange ring.

Any suggestions on how to make this look good in both carbon and carbon
classic.

Thanks,


W.



register off
local fn plotMyIconRef(r as ^rect, iconRef as IconRef)
register on
dim @ btnR        as Rect                     
dim   err         as long 

long if iconRef > _"    "
// if iconRef is a 4 character code then get system icon
err = fn GetIconRef( 0, _kSystemIconsCreator,  iconRef, @iconRef)
end if
err = FN PlotIconRef
(#r,_kAlignNone,_kTransformNone,_kIconServicesNormalUsageFlag,iconRef)
end fn


local fn createBadgedIcon( alertType as long )
dim osErr       as OSErr
dim thisPSN     as ProcessSerialNumber
dim processInfo as ProcessInfoRec
dim @iconRef    as IconRef
dim as FSSpec   fs 
dim as rect    r,badgeR,frameR
dim as handle @ pictH
dim @label      as SInt16
dim &

processInfo.processInfoLength = sizeof( ProcessInfoRec )
processInfo.processName       = _nil // don't want 
processInfo.processAppSpec    = fs

osErr = fn GetCurrentProcess( thisPSN )
osErr = fn GetProcessInformation( thisPSN, processInfo )
osErr = FN GetIconRefFromFile (fs,IconRef,label)
call setrect(frameR,0,0,64,64)

badgeR.right  = frameR.right
badgeR.bottom = frameR.bottom
badgeR.left   = frameR.right  - ((frameR.right - frameR.left)/2)
badgeR.top    = frameR.bottom - ((frameR.bottom - frameR.top)/2)

//call offsetrect(frameR, 20, 20)
//call offsetrect(badgeR, 20, 20)


PICTURE ON (0,0)-(64,64)

select alertType 
case _kAlertStopAlert 
fn plotMyIconRef( frameR, _kAlertStopIcon)
fn plotMyIconRef( badgeR, IconRef)
case _kAlertCautionAlert 
fn plotMyIconRef( frameR, _kAlertCautionIcon)
fn plotMyIconRef( badgeR, IconRef)
case _kAlertNoteAlert
fn plotMyIconRef( frameR, IconRef)
// no badge on note alerts
end select 

PICTURE OFF, pictH

SetRect(r, 20, 20, 84, 84)
//PICTURE FIELD  #1 ,&pictH,@r,_pfTransparent,_cropPict
PICTURE FIELD  #1 ,&pictH,@r,_pfNoFramed,_cropPict

end fn


window 1
fn createBadgedIcon( _kAlertStopAlert )
//fn createBadgedIcon( _kAlertCautionAlert )
//fn createBadgedIcon( _kAlertNoteAlert )

do
handleevents
until 0