Board index » delphi » Cursors Not Working Correctly in Resource File

Cursors Not Working Correctly in Resource File

I would like to know if anyone else has seen the following unusual behavior
with custom cursors in a resource file.  When I created just one cursor
(named CRZOOMIN) and nothing else in a resource file, there was no problem
using the cursor in my app.  However, when I added a second cursor (named
CRZOOMOUT) to the resource file, and then tried to use that cursor in my
app, the cursor would change from the default arrow to nothingness.  The
first cursor was still ok and visible when you assigned it to a control
(control.cursor) though.
For a test I renamed the second cursor (CRZOOMOUT) to "TEST", recompiled and
viola it was now visible.  I renamed it back to CRZOOMOUT in the Image
editor, recompiled and again the cursor would just disappear when I wanted
to use it.  After further playing around I was able to use the second cursor
with the resource name CRZOOMOUT after I added a blank cursor into the
Resource file with a name that was alphabetically before the cursors I
wanted to use (CRZOOMA) so that It appeared first on the Cursor treelist in
the resource file.  Using this technique I have added half a dozen more
cursors to the same resource file and have not had any other disappearing
problems since...

A response from Inprise or TeamB member would be appreciated.

Thanks,

Mouse

 

Re:Cursors Not Working Correctly in Resource File


BTW, I'm using D4 service pack 2

Thanks again,

Mouse

Re:Cursors Not Working Correctly in Resource File


Hi,

the following I did in D3 but it shouldn't work by another way in D4:

Created the *.res with two cursors, named it AddCursors.res.

{...}
implementation

{$R *.DFM}
{$R AddCursors.res}

const
  crZoomIn = 5;
  crZoomOut = 6;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Screen.Cursors[crZoomIn] := LoadCursor(HINSTANCE, 'CRZOOMIN');
  Screen.Cursors[crZoomOut] := LoadCursor(HINSTANCE, 'CRZOOMOUT');
  Button1.Cursor := crZoomIn;
  Button2.Cursor := crZoomOut;
end;

{...}

Works without problems.

Good luck!
Kerstin

Quote
Mouse wrote:
> I would like to know if anyone else has seen the following unusual
> behavior
> with custom cursors in a resource file.  When I created just one
> cursor
> (named CRZOOMIN) and nothing else in a resource file, there was no
> problem
> using the cursor in my app.  However, when I added a second cursor
> (named
> CRZOOMOUT) to the resource file, and then tried to use that cursor in
> my
> app, the cursor would change from the default arrow to nothingness.
> The
> first cursor was still ok and visible when you assigned it to a
> control
> (control.cursor) though.
> For a test I renamed the second cursor (CRZOOMOUT) to "TEST",
> recompiled and
> viola it was now visible.  I renamed it back to CRZOOMOUT in the Image

> editor, recompiled and again the cursor would just disappear when I
> wanted
> to use it.  After further playing around I was able to use the second
> cursor
> with the resource name CRZOOMOUT after I added a blank cursor into the

> Resource file with a name that was alphabetically before the cursors I

> wanted to use (CRZOOMA) so that It appeared first on the Cursor
> treelist in
> the resource file.  Using this technique I have added half a dozen
> more
> cursors to the same resource file and have not had any other
> disappearing
> problems since...

> A response from Inprise or TeamB member would be appreciated.

> Thanks,

> Mouse

Re:Cursors Not Working Correctly in Resource File


On Fri, 30 Oct 1998 21:56:37 -0800, "Mouse" <snsil...@pacbell.net>
wrote:

Quote
>I would like to know if anyone else has seen the following unusual behavior
>with custom cursors in a resource file.  When I created just one cursor
>(named CRZOOMIN) and nothing else in a resource file, there was no problem
>using the cursor in my app.  However, when I added a second cursor (named
>CRZOOMOUT) to the resource file, and then tried to use that cursor in my
>app, the cursor would change from the default arrow to nothingness.  The
>first cursor was still ok and visible when you assigned it to a control
>(control.cursor) though.

There was a problem in the original Image Editor, long ago, that had
symptoms similar to this, but I hadn't heard any recent reports. Can
you give a step-by-step series of operations that you performed that
will reproduce the problem?

-Steve

Other Threads