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 <–| )
Anyway, anybody else stumble over this?
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…
plus I now have 24x24 instead of 16x16 cursors.
[quote=73452:@Dave S]If you mean the XML cursor format used in Carbon… I too have found that does NOT work in Cocoa…
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.
Resources - unsupported since resource forks were removed (they were deprecated many many years ago)
Convert them to PNG’s or something & use the code to construct one from a picture
[quote=73463:@Norman Palardy]Resources - unsupported since resource forks were removed (they were deprecated many many years ago)
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?
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
Karen here is the class I wrote for my own use to make graphic cursors (24x24)’
You can use it as is… or as a source for how to make/use this type cursor
[quote=73468:@Dave S]Karen here is the class I wrote for my own use to make graphic cursors (24x24)’
You can use it as is… or as a source for how to make/use this type cursor[/quote]
Thanks Dave. Some of those may be useful in the future!
I know how Cursor to make the new style cursors… I just don’t have any software to help draw them so want to use the ones I have.
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.
Instead of complaining I decided I should do something useful …
Using a listbox I threw together a crude FatBits Cursor editor in Xojo to make simple black and white cursors.
how does the following code in the get_cursor method work?
[code] img_id = Min( Max( 0, img_id-1 ), max_cursors )
x = ( img_id And 7 )
y = ( img_id-x ) \ 8[/code]
I know what it does, but I’m puzzled by the x = ( img_id And 7 )
For example with
Protected Function AllScroll() As MouseCursor
x should be zero
so what am I missing here?
no… X would be 5 and Y would be 0
The images for each cursor are in a single PNG file… the calculates what “cell” to extract to use as the cursor
Should be explained somewhat in the notes
Got it now. I was thinking boolean AND but AND is overloaded , so with two integers it is equivalent to BitAnd from the BitWise class.
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)
[/code] (taken from MacOSLib)
And, btw: There is a NSCursor class which has an imitwithimage method: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/Reference/Reference.html
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.)
Where should that declare go???
I tried both the WIndow Open and the Canvas Open and “Self” is not the proper datatype at those locations
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)
HOWEVER… this turned off ALL ability to use custom cursors … the exact opposite of desired results
The docs are not really epic in length on this topic:
Use this method when you need to do some special cursor manipulation and you dont want the Application
So its rather switch off everything instead of switch off cursor automatics