[Mac] Drawing iconForFileType ???
Posted: Mon Mar 07, 2016 11:37 pm
Any Cocoa experts know why this code seems to work in PB 5.31, but not in PB 5.41-42 ???
The ImageID is not null, so maybe it's not a Cocoa Icon issue, maybe it's a PB DrawImage() issue?
The ImageID is not null, so maybe it's not a Cocoa Icon issue, maybe it's a PB DrawImage() issue?
Code: Select all
Size = 128
OpenWindow(0, 0, 0, Size, Size, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ImageID = CocoaMessage(0, CocoaMessage(0, 0, "NSWorkspace sharedWorkspace"), "iconForFileType:$", @"txt")
If Not ImageID
Debug "Failed to get image"
End
EndIf
CreateImage(0, Size, Size, 32, $c0c0c0)
If StartDrawing(ImageOutput(0))
DrawImage(ImageID, 0, 0, OutputWidth(), OutputHeight())
StopDrawing()
EndIf
ImageGadget(0, 0, 0, Size, Size, ImageID(0))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow