Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borland Builder project resource file - cursor 1

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi,
I am looking into using a custom cursor for my Projects forms, I know that inorder to do this I need to add the cursor to the resource file, for some reason I can't figure out how to do it. Can anyone tell me how?

Thanks
 
Hi Wings,

I did it like that:

run the Tools -> Picture Editor

click filemenu->Open

find the folder where Your project resides
there SHOULD be already one *.res file, with your project name.
open this up.
rightclick on its window and select with NEW what you want to create.
make Your cursor and save it (my name is: MYCURSOR)
it ends in the projects' *.res file and is now available.

then I added
Code:
        static const TCursor crMyCursor = 0xffffffe9;
to my mainform's headerfile (to make it known to the "Screen"),
and enumerated the cursors new, then loaded it:
Code:
        enum TCursor {crMin=0x7fff-1, crMax=0x7fff};
        Screen->Cursors[crMyCursor] = LoadCursor(HInstance, "MYCURSOR");
within my mainforms' ::FormCreate(TObject *Sender) method.

Now anywhere You want You set:
Code:
       TCursor SaveCursor = Screen->Cursor;    // keep the original in mind 
       Screen->Cursor = myCursor;
be aware that You do it in a try...catch to set the original cursor again...

AND: I the BCB-HELP it is said to write ProcessMessages(Application) to make the cursor visible. This is a little tricky as You don't always want every message processed (e.g. when You want to show a modal window )...

LIMITATION: only black and white cursors...

Does anybody have an idea to integrate coloured cursors?
(I think its the bcbdevFAQ52 page, any simplier solutions?)

Try this, have fun and a HAPPY NEW YEAR!!!!!!!!!
regards
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top