Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,159

    Post Function: Change Mouse Cursor

    Attached is a project that includes two functions that allow you to change the mouse cursor within your project. These functions call on functions within the user32.dll on the windows system.

    Here is an example of how to use the functions

    Code:
    --[[
    Use this function with one of the following codes
    to set the mouse to busy or other type of cursor 
    
    **********************************************************************************
    ** IDC_APPSTARTING 	= 32650                                                     **
    ** The application starting cursor (arrow and hourglass).  						**
    ** IDC_ARROW 		= 32512                                                     **
    ** The regular arrow pointer cursor.  											**
    ** IDC_CROSS 		= 32515                                                     **
    ** The cross cursor.  														 	**
    ** IDC_IBEAM 		= 32513                                                     **
    ** The I-shaped beam cursor (text editing cursor).  							**
    ** IDC_ICON 		= 32641                                                     **
    ** Win NT only: An empty cursor.  												**
    ** IDC_NO 			= 32648                                                     **
    ** The "no" symbol cursor (circle with a slash).  								**
    ** IDC_SIZE 		= 32640                                                     **
    ** Win NT only: The four-pointed resize/move arrow.  							**
    ** IDC_SIZEALL 		= 32646                                                     **
    ** The four-pointed resize/move arrow. 											**
    ** IDC_SIZENESW 	= 32643                                                     **
    ** The double-pointed resize arrow pointing to the upper-right and lower-left. 	**
    ** IDC_SIZENS 		= 32645                                                     **
    ** The double-pointed resize arrow pointing up and down. 						**
    ** IDC_SIZENWSE 	= 32642                                                     **
    ** The double-pointed resize arrow pointing to the upper-left and lower-right.  **
    ** IDC_SIZEWE 		= 32644                                                     **
    ** The double-pointed resize arrow pointing left and right.  					**
    ** IDC_UPARROW 		= 32516                                                     **
    ** The up-arrow cursor. 														**
    ** IDC_WAIT 		= 32514                                                     **
    ** The wait cursor (hourglass).                                                 **
    **********************************************************************************
    ]]--
    --Example:
    resetCursor = SetCursor(32514);
    --do something here
    ReturnCursor(resetCursor)
    Here are the two functions. The first function requires that you use one of the above codes to change the cursor, such as to the hourglass (32514). It will also return the default arrow key that was used before you changed the cursor. This value will be used in the second function.

    Code:
    function SetCursor(cursor)
    	-- Get current cursor 
    	local holdCursor = DLL.CallFunction(_SystemFolder.."\\User32.dll", "GetCursor", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL); 
    	
    	-- Load hourglasscursor 
    	local hCursor = DLL.CallFunction(_SystemFolder.."\\User32.dll", "LoadCursorA", "0, "..cursor, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    	
    	-- Display loaded cursor 
    	local retVal = DLL.CallFunction(_SystemFolder.."\\User32.dll", "SetCursor", hCursor, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    
    	--return the holdCursor 
    	return holdCursor;
    	
    end
    The second function is used to change the cursor back to it's original state. In the example above it uses the returned value from the first function.

    Code:
    function ReturnCursor(resCursor)
    	-- Display original cursor 
    	local retVal = DLL.CallFunction(_SystemFolder.."\\User32.dll", "SetCursor", resCursor, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    end
    There are limitations to this function. If you move the mouse outside the AMS window it reverts to the normal arrow. If you mouse over anothe object within the AMS window it reverts to the normal arrow again. I hope you find this useful for your projects.

    Here is a sample project.
    Attached Files
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  2. #2
    Join Date
    Jul 2004
    Posts
    5

    Huh? Set cursor

    Hi

    Ive bin trying to use the setCursor coding that you suggested but the screen keeps displaying that the setCursor contains a nil value. Have you any idea how i can fix this because I really need to show the hourglass icon when the button is pressed and is waiting for the next page to be displayed.

    Thanks

  3. #3
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,159
    Can you show me the code that gives this error?

    Make sure that when you use the function you specify a number to set the cursor to.

    resetCursor = SetCursor(32514);--this changes the cursor to wait
    --do something here
    ReturnCursor(resetCursor):
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  4. #4
    Join Date
    Jul 2004
    Posts
    5

    Set Cursor

    OK,

    Sorted out the error message that I was getting, but the method still does not work.

    What I'm trying to do is show the hourglass on a button click. The button click also does a page.jump.

    Then I'm trying to revert the cursor back to the arrow. I'm trying the revert the cursor on the Show event of the page.

    Any ideas?

  5. #5
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,159
    I have not tried to change the cursor during a page jump. Are you receiving an error of does it just not work?
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  6. #6
    Join Date
    Sep 2004
    Posts
    1

    set cursor

    Hi im having the same problem with the page jump. No error message appears it just does not work. Any possible suggestions on how to fix this.

  7. #7
    Join Date
    May 2006
    Posts
    75

    Arrow hi

    freinds
    i want when mouse entered in mroject ( over mouse on project ) then cursor change
    how?

Similar Threads

  1. Thumblist Object... change mouse cursor
    By itamar in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-18-2004, 01:51 PM
  2. Example: Make an Image 'Follow' the Mouse Cursor
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-18-2004, 10:06 AM
  3. Thumblist... how to change mouse cursor?
    By zzzs in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-14-2004, 01:44 PM
  4. Mouse Over Text: Can I Add Italics, Change Font, etc.?
    By jdanniel in forum AutoPlay Media Studio 4.0
    Replies: 9
    Last Post: 06-10-2003, 04:55 PM
  5. Mouse over - change images
    By Mat in forum AutoPlay Media Studio 4.0
    Replies: 6
    Last Post: 10-14-2002, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts