Am Donnerstag, den 28.06.2007, 16:32 +0200 schrieb Lord Satan:
> On Thu, 28 Jun 2007 07:10:29 +0800
> Павел Ишенин <[EMAIL PROTECTED]> wrote:
>
> > Not to do this you can create ico file with empty shape, load it and set
> > cursor to it:
> >
> > Screen.Cursors[1] := LoadCursorFromLazarusResource('my_empty_cursor');
> > Screen.Cursor := 1;
>
> I cannot get it to work. I always get an AV on LoadCursorFromLazarusResource.
> Is there anything special about the .ico file I have to create? I tried it
> with a 1x1 pixel file created with the Gimp and saved as .ico. Then using
> lazres to create a .lrs.
> I tried it again with mouse.ico from the lazarus/images directory, again an
> AV.
> I am sure that I am doing something wrong, but I don't know what.
For GTK1 I'm using an "invisible" cursor having all bits to zero. This
is fine as long there are no position issues are involved, e.g. if the
invisible cursor is over a button, the button is highlighted. I did not
try to use something in lazaurs since the program is plain fpc and gtk1.
const
cursorbits:array[0..31] of char =
(#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0);
cursormask:array[0..31] of char =
(#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0);
var
cursor: PGdkCursor;
source, mask: PGdkPixmap;
begin
gtk_init (@argc, @argv); // this has to be done first!
source := gdk_bitmap_create_from_data (NULL, cursorbits, 16, 16);
mask := gdk_bitmap_create_from_data (NULL, cursormask, 16, 16);
cursor := gdk_cursor_new_from_pixmap (source, mask, @fg, @bg, 8, 8);
gdk_pixmap_unref (source);
gdk_pixmap_unref (mask);
After that I'm using the ugly hack of moving the cursor offscreen, too.
HTH,
Marc
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives