Customize cursor make an error

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
elchamaquito
Posts: 5
Joined: Thu Nov 23, 2006 9:23 pm
Contact:

Customize cursor make an error

Post by elchamaquito » Mon Feb 21, 2011 10:58 pm

I have a stack with a button and some png images with 16x16, 24x24 and 32x32 sizes. The button script is

Code: Select all

on mouseUp
   lock cursor
   set the cursor to 1008 -- this is one of images ID
   unlock cursor
end mouseUp
and when i push a button, the stack is closed and revolution too. This is a bug?

I work on Windows 7 with Revolution 4.0, what is the error?

Thanks

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Customize cursor make an error

Post by Dixie » Tue Feb 22, 2011 12:11 am

hi...

try this in a button... lock your cursor after you set it and unlock it in the 'mouseUp' handler else you won't see the change.

Code: Select all

on mouseDown
   set the cursor to hand 
   lock cursor
end mouseDown

on mouseUp
   unlock cursor
end mouseUp
be well...

Dixie

elchamaquito
Posts: 5
Joined: Thu Nov 23, 2006 9:23 pm
Contact:

Re: Customize cursor make an error

Post by elchamaquito » Tue Feb 22, 2011 1:35 am

hi Dixie,

The code that you posted work fine, but I try this, an error persist yet. The stack and Revolution application are closed inmediatly before I leave the mouse click.

Code: Select all

on mouseDown
   -- set the cursor to hand
   set the cursor to 1008 -- this is one of images ID
   lock cursor
end mouseDown

on mouseUp
   unlock cursor
end mouseUp
Thanks for your quick answer.

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Customize cursor make an error

Post by AndyP » Tue Feb 22, 2011 1:26 pm

1: Try using: set the defaultcursor to 1008

2: What type of image is your 1008 cursor image? 32bit transparent PNG works well.

3: Try changing the image id to soething high eg 10000 there may be a hidden conflict with the id 1008?
Andy .... LC CLASSIC ROCKS!

elchamaquito
Posts: 5
Joined: Thu Nov 23, 2006 9:23 pm
Contact:

Re: Customize cursor make an error

Post by elchamaquito » Tue Feb 22, 2011 4:25 pm

Hi AndyP,
AndyP wrote:1: Try using: set the defaultcursor to 1008


This make an error equal. :(
AndyP wrote:2: What type of image is your 1008 cursor image? 32bit transparent PNG works well.
Well, here is a trick. I don't know how you make a transparent png with 32bits. I use PhotoShop.
Some pictures I managed to digest them (16x16x8, with others configurations), but others do not.
However, I believe that this is still a mistake, because Revolution should verify the characteristics of the image before it assigns, and display an error message.
AndyP wrote:3: Try changing the image id to soething high eg 10000 there may be a hidden conflict with the id 1008?
This make an error equal. :(

And well, reading any more the help, because my english is so bad :( , I discovered the follow text.

You can also set the cursor property to the ID of an image. Custom cursor images must contain three colors: black, white, and a transparent color.

This mean that my custom cursor may not have other colors that not are black, white and transparent?
It's not possible to use custom cursor with others colors?
It's not possible to use other image format like .cur?

Thanks.

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Customize cursor make an error

Post by doc » Wed Feb 23, 2011 6:22 am

Hey folks,
When using Rev 4.0 on Windows 7, just as elchamaquito is doing, I'm seeing the exact same crash as he described in his original post.
It crashes while in the IDE and it crashes the simple test executable as well... every time it tries to display the cursor.

Same test stack on LC 4.53.... no crash in the IDE or the executable, but I'm seeing very erratic cursor behavior.

I have attached my sample stack if you want to try it for yourself.

Best regards,
-Doc-
Attachments
testme.zip
(3.25 KiB) Downloaded 297 times

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Customize cursor make an error

Post by Klaus » Wed Feb 23, 2011 12:44 pm

Hi Friends,

with LiveCode 4.5.x RunRev added a more "forgiving" support for curors! :D
Before that LiveCode was more than "§picky" when it comes to cursors!

One trick to get custom cursors to work is this:
1. Create you cursor as black and white and with tranparency.
2. Save it as GIF or PNG (8 bit)
3. Import that image into your stack
4. Coose any PAINT tool
5. Click ONCE on the image and
6. choose "Undo" immediately.
7. This way LiveCode changes the image type internally and now the cursor should be usable

Or better:
Upgrade to LC 4.5.x :D


Best

Klaus

elchamaquito
Posts: 5
Joined: Thu Nov 23, 2006 9:23 pm
Contact:

Re: Customize cursor make an error

Post by elchamaquito » Thu Mar 10, 2011 5:50 pm

Klaus wrote:Hi Friends,

with LiveCode 4.5.x RunRev added a more "forgiving" support for curors! :D
Before that LiveCode was more than "§picky" when it comes to cursors!

One trick to get custom cursors to work is this:
1. Create you cursor as black and white and with tranparency.
2. Save it as GIF or PNG (8 bit)
3. Import that image into your stack
4. Coose any PAINT tool
5. Click ONCE on the image and
6. choose "Undo" immediately.
7. This way LiveCode changes the image type internally and now the cursor should be usable
Livecode 4.5.x allows customized cursors with more sophisticated styles of colors and animations?
Klaus wrote:Or better:
Upgrade to LC 4.5.x :D
This is something very difficult for some people who do not have many possibilities, and excuse me for the follow question:

Why not released at least one version of Revolution, for people of different communities can improve this great project?

It is impossible to provide in terms of improving a project, if you do not have the sources. I do not ask to be released in full, but a version; perhaps the oldest and the latter of Revolution, before changing to LiveCode.

Major companies like Qt has survived well.

Again I apologize for the off topic in my last words.

Thanks.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Customize cursor make an error

Post by Klaus » Thu Mar 10, 2011 6:10 pm

Hola chamaquito,

LiveCode >= 4.5 only allows static cursors, no animations!

But you can use now GIF, PNG (with alpha channel!) or JPG images as a cursor.
And you can use larger images as cursors!

Unfortunately the docs look loke they were not yet updated to refelct these changes and I do
not know by heart the exact maximum dimensions for cursors on the dufferent platforms.
This is something very difficult for some people who do not have many possibilities, and excuse me for the follow question:
Why not released at least one version of Revolution, for people of different communities can improve this great project?
It is impossible to provide in terms of improving a project, if you do not have the sources. I do not ask to be released in full, but a version; perhaps the oldest and the latter of Revolution, before changing to LiveCode.
Major companies like Qt has survived we
I am just a "user" of the software, so you will need to ask the RunRev company for an answer! 8)


Best

Klaus

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Customize cursor make an error

Post by Klaus » Mon Mar 14, 2011 4:59 pm

Hi all,

for your interest here the missing part of the docs about using custom cursors:
...
Cursor support has been improved in several ways.
The image will now automatically process any image to convert to a form suitable for display on the current platform and screen depth taking this burden off the developer. Specifically, the engine will scale the image down to the appropriate size, and reduce the number of colors to the appropriate number of colors.
Additionally, the engine has been updated to take advantage of support for larger and potentially alpha-blended cursors on platforms that support this. Specifically:
• Windows XP and above support full alpha-blended cursors up to 64x64
• More recent Linux distributions support alpha-blended cursors up to a size of 64x64
• Mac supports alpha-blended cursors up to 256x256 The engine now picks up the GTK cursor theme on Linux. (4.5.1)
Note: It appears that alpha-blending support depends on the current screen depth on some platforms.
...

Best

Klaus

elchamaquito
Posts: 5
Joined: Thu Nov 23, 2006 9:23 pm
Contact:

Re: Customize cursor make an error

Post by elchamaquito » Tue Mar 29, 2011 9:24 pm

Klaus wrote:I am just a "user" of the software, so you will need to ask the RunRev company for an answer! 8)
Sorry. :oops:

Is that I felt very tied by not being able to resolve what was wrong, or for give it a functionality that I want something that does not.
Sorry any more, I'm accustomed to the facilities of open source and I thought you were some kind of Runrev employee.

Thank you Klaus, for your best attention.

Post Reply