When dragging a file from Finder to, say, Mail, I get a nice pointer arrow with a green + symbol. What is the standard way of letting the user know that the file being dragged is acceptable to my application?
Why not implement the exact same thing?
In an app I am currently writing I have designed a group of 24x24 pointers (16x16 is too small, 32x32 is too big)
then I replaced SystemCursors. with my own CustomCursors. class and have some nifty and custom pointers
never have figured this out… above message has the exact same image tag as this message does
[quote=14924:@Dave S]Why not implement the exact same thing?
In an app I am currently writing I have designed a group of 24x24 pointers (16x16 is too small, 32x32 is too big)
then I replaced SystemCursors. with my own CustomCursors. class and have some nifty and custom pointers[/quote]
It’s pretty hard to match the given system/version you are on? OS X, Linux, Windows XP, Windows Vista, Windows 7, Windows 8 isn’t it?
Not sure what you are asking???
I’m on OSX… custom cursors were not available under Carbon, but are now under Cocoa
I don’t see anything in the LR (under MOUSECURSOR - Custom Cursors) that indicates it is OSX only
FUNCTION GET_CURSOR(img_id as integer, hotspot_x=12,hotspot_y=12) as MOUSECURSOR
Dim p As picture
Dim x As Integer
Dim y As Integer
' from 1 to Max_Cursors
img_id=Min(Max(0,img_id-1),max_cursors)
x=(img_id And 7)
y=(img_id-x)\\8
x=(x*(cursor_size+1))+1
y=(y*(cursor_size+1))+1
p=New picture(Cursor_Size,Cursor_Size,32)
p.Graphics.DrawPicture CURSOR24,0,0,cursor_size,cursor_size, x,y,Cursor_Size,Cursor_Size
p.Transparent=1
xLastCursor=img_id
Return New MouseCursor(p,hotspot_x,hotspot_y)
END FUNCTION
const CURSOR_SIZE=24
const MAX_CURSORS=26
And if you need to know what version of OSX -or- Windows you are running under
FUNCTION OSXVersion as string
Dim noerror As Boolean
Dim result As Integer
Dim sver As String
Dim sversion As String
Dim os As String
#If TargetMacOS
noerror=System.Gestalt("sysv",result)
If noerror Then
sver=Hex(result)
sversion=sver.Left(2) + "." + sver.Mid(3,1) + "." + sver.Right(1)
OS_CODE=Val(sver.Mid(3,1))
Select Case OS_CODE
Case 0
os="Cheetah"
Case 1
os="Puma"
Case 2
os="Jaguar"
Case 3
os="Panther"
Case 4
os="Tiger"
Case 5
os="Leopard"
Case 6
os="Snow Leopard"
Case 7
os="Lion"
Case 8
os="Mountain Lion"
Case Else
os="Unknown"
End Select
Return "Mac OSX "+os+" "+sversion
Else
Return ""
End If
#ElseIf TargetWin32
OS = "Windows"
//try to be more specific of windows version
Soft Declare Sub GetVersionExA Lib "Kernel32" ( info As Ptr )
Soft Declare Sub GetVersionExW Lib "Kernel32" ( info As Ptr )
Dim info As MemoryBlock
If System.IsFunctionAvailable( "GetVersionExW", "Kernel32" ) Then
info = New MemoryBlock( 20 + (2 * 128) )
info.Long( 0 ) = info.Size
GetVersionExW( info )
Else
info = New MemoryBlock( 148 )
info.Long( 0 ) = info.Size
GetVersionExA( info )
End If
Dim Str As String
OS_CODE=info.Long(4)*100+info.long(8)
Select Case OS_CODE
Case 400
os = "Windows 95/NT 4.0"
Case 410
os = "Windows 98"
Case 490
os = "Windows Me"
Case 300 To 399
os = "Windows NT 3.51"
OS_CODE=30
Case 500
os = "Windows 2000"
Case 501
os = "Windows XP"
Case 502
os = "Windows Server 2003"
Case 600
os = "Windows Vista"
Case 601
os = "Windows 7"
Case 602
os = "Windows 8"
End Select
Str = " Build " + Str( info.Long( 12 ) )
If System.IsFunctionAvailable( "GetVersionExW", "Kernel32" ) Then
Str = Str + " " + Trim( info.WString( 20 ) )
Else
Str = Str + " " + Trim( info.CString( 20 ) )
End If
os = os + Str
Return os
#EndIf
END FUNCTION
I mean it would be pretty hard to match a custom mouse cursor with the mouse cursor provided by the system on all the different platforms? You would have to have to have versions of a mouse cursor graphic for all the various platforms you intend to run on?
I doubt there are “standards”… at least not the I’ve been able to find… but if so, just create a CURSOR24.PNG for each OS
BTW… If there ARE standards for the cursors in my image… Please point me at them
You can try getting the cursor image from the OS, draw on that, then make a new cursor. Though isn’t each OS pretty consistent in it’s arrow pointer so you can just build mac win lin pics. Anyways here’s some naive code to get the mac arrow pointer image, complete with alpha channel. It uses the MacOSLib NSImage class
[code] const CocoaLib = “Cocoa.framework”
soft declare function NSClassFromString lib CocoaLib (aClassName as CFStringRef) as Ptr
soft declare function arrowCursor lib CocoaLib selector “arrowCursor” (id As Ptr) As Ptr
soft declare function image lib CocoaLib selector “image” (id As Ptr) As Ptr
dim img As new NSImage(image(arrowCursor(NSClassFromString(“NSCursor”))))
dim pic As Picture = img.MakePicture[/code]
A problem is that it doesn’t respect size. I made my cursor large yet that code still returns the standard size, even asking for currentCursor or currentSystemCursor instead of arrowCursor. Maybe there’s something that can be done with the NSImage size to get the more full res image…