I have some custom cursors I created long ago and borough forward through various versions of RB/RS/Xojo as project items.
In the current version of Xojo they work in Carbon and on Windows but NOT on Cocoa. Using a cursor from System.Cursors does (but the ones I want are not there as far as I can see - I think more should - specifically the |–> and <–| )
If you mean the XML cursor format used in Carbon… I too have found that does NOT work in Cocoa…
I just updated one of my projects to use the new constructor style mouse cursor…
The nice thing is I managed to change the code in about 20 minutes…
For the most part it was just changing the namespace to match my custom class instead…
[quote=73452:@Dave S]If you mean the XML cursor format used in Carbon… I too have found that does NOT work in Cocoa…
[/quote]
I don’t know how they are stored internally. I originally created them in ResEdit many years ago and stored them in the IDE… Over the years I just kept bringing the project with the cursors into new RB/RS/Xojo versions version and they just worked… This is the first time I tried using one of them in Cocoa however.
[quote=73463:@Norman Palardy]Resources - unsupported since resource forks were removed (they were deprecated many many years ago)
[/quote]
So the IDE still can use resource forks,for Windows and Carbon? (My cursors work there).
BTW the IDE displays them as expected in the Navigator, and show the pixels and hot spot in the cursor “editor” so Xojo obvious know the are cursors and how to display them…
Maybe you might want to take a look at the project attached to teh feedback report?
[quote]
Convert them to PNG’s or something & use the code to construct one from a picture[/quote]
How? aft this point all I have are the cursors in the projects (no external files) . I can copy and paste them between projects, but when I try to export one of those cursors, it looks like it is doing it, but no file is produced!
If the internal format of the cursor is deprecated (some support for it is obviously still in place), Ideally the IDE should offer to convert it to the new preferred internal format that works in cocoa. Failing that it should have at least given an error when compiling for Cocoa instead of failing silently.
BTW I just attached a TIFF that shows how teh IDE does recognize it as cursor, but when I select it feedback does not display the picture like it used to in the area below the list of uploaded. files … New bug in feedback?
BTW since the IDE is a Cocoa app and it CAN read the cursor and display it correctly in the IDE , I am confused
Might I point you to PAINTDS on my website (shameless plug)
That is what I used to make the Cursors image in the code I posted.
and a new version of PaintDS (all in Cocoa and using internally that cursor code) will be posted later today.
Some of the cursors in the package were designed for use by PaintDS, the rest are replacements for the standard cursor set.
I just discovered an “issue” and I don’t think it has to do with my cursor class directly.
On window “A” I have a main canvas, and a couple of ancillary canvas
each canvas has its own custom cursor (“hand” for the ancillary, and the main changes depending on what the user is doing)
This all works quite well… UNTIL
If the user chooses a particular command… it opens a SECOND window (floating)… at which time the cursor reverts to SYSTEM pointer for all windows, all canvas… even if I execute the code to redefine it again…
As soon as I close the floating window… the custom cursors immediate begin working again for the main window
FYI… I have tried all different types for the 2nd window (floating, movable modal etc. etc.) all react the same
Not sure if this has anything to do with it, Dave, but according to Apples Developer docs you have to disable cursorrects when you dont want App Kit to interfere with the cursor handlings:
[code] #if TargetCocoa
declare sub disableCursorRects lib CocoaLib selector “disableCursorRects” (obj_id as Ptr)
This is not yet implemented into MacOSLib, but it doesnt seem that difficult. It accepts an NSImage and comes together with a set hotspot function anyone tried if this works? Thinking of flickering and awkwardly moving custom cursors in some games, I would rather go for the system routine.
(what comes to Mind, Dave: I experience a similar behavior with a child HUD window. I created a floating window which works correctly all the time until one opens the child. No matter what I set its states to, the window group will not float anymore until I close the HUD window. I guess its a feature of Mac OS more than a bug, probably much like your custom cursor disappearing. But I found no clue so far on how to override the, err, override.)
Uh sorry, Ive taken it from MacOSLibs NSWindow Class where it is defined as a method. Didnt try it together with your code. I guess youd have to add an NSWindow property to your window in order to make it work.
Ok… I had to make this change (PTR to INTEGER) for it to compile (this change was based on similar declare signatures discussed in other topics on this forum)
declare sub disableCursorRects lib "Cocoa" selector "disableCursorRects" (obj_id as integer)
disableCursorRects me.handle
HOWEVER… this turned off ALL ability to use custom cursors … the exact opposite of desired results
Oh sorry.
The docs are not really epic in length on this topic:
Discussion
Use this method when you need to do some special cursor manipulation and you dont want the Application
Kit interfering.
So its rather switch off everything instead of switch off cursor automatics