How do I set the icon for an item in an RB popup menu without RB's
menu events becoming disconnected? I've tried my function... (which
uses some MBS calls). It sets the icon fine all the time, but after
you do this once, the Change event never fires again in RB, and you
can't select a new item in the popup.
Protected Sub AssignIconToMenu(F As FolderItem,ctrl As
PopupMenu,iPosition As Integer)
#If TargetCarbon Then
#If TargetMachO Then
Declare Function SetMenuItemIconHandle Lib "Carbon" (inMenu as
Integer, inItem as Integer, inIconType as Integer, inIconHandle as
Integer) as Integer
#Else
Declare Function SetMenuItemIconHandle Lib "CarbonLib" (inMenu
as Integer, inItem as Integer, inIconType as Integer, inIconHandle as
Integer) as Integer
#EndIf
Dim P As Picture
Dim p2 As CGImageMBS
Dim osErr As Integer
Const kMenuCGImageRefType = 7
If F <> Nil Then
p = F.IconImageMBS(16).CloneMBS
p.Mask.Graphics.DrawPicture(F.IconMaskMBS(16),0,0)
Else
P = NewPicture(16,16,32)
End If
p2 = CGCreateImageMBS(P,P.Mask)
osErr = SetMenuItemIconHandle
(ctrl.MenuMBS.Handle,iPosition,kMenuCGImageRefType,p2.Handle)
ctrl.Refresh()
#EndIf
End Sub
Thanks,
Josh
--
Josh Hague
Web Guru
Cell: 604-831-4891
URL: http://www.JoshHague.com/
E-Mail: [EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>