If the script is running as a compiled VB app you can use the form.mousepointe syntax.
Otherwise I am not sure if there is a way in a cognos macro to do it.
The script that you inclued in your message works but if I include in my macro it doesn't. The cursor take an orginal apearance when the instruction that follow SetCursor will execute.
Do you know why it's not works? Do you know something that change a cursor appearence when it execute?
I believe the WinAPI call will not be effective because the macro maintains no open window while it runs. Normally that API call would give an hourglass cursor when you mouse over the application that calls it. With no open window, the call is ineffective (my guess).
If you have access to the Cognos support site, look in the Supportlink archives for the term 'ShowStatus'. There is an excellent article on how to create an activeX control that relays status information on macro progress to the end user. That may be what you are really looking for.
Regards,
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data" Want good answers? Read FAQ401-2487 first!
Ho surprise, I start the macro from mcx and not from .mac(F5) and the cursor appearance change when I use the API and stay in this status while I don't change it to original appearance.
Thank's to Roland for the API.
Dave, I think that not works in developper environnement because a window controler is .mac file and it receives for windows an instruction to reset a cursor appearance to original. When the .mcx is executed, the controler is the dialog box.
When I try to test this, it works fine from the .mcx based on your code above. When I insert a msgbox function before the cursor change to indicate the start of the test, the cursor does not change after the msgbox is closed. As I would want to use this after a dialog box call to get user input, any thoughts on why the behavior changes?
Thanks,
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data" Want good answers? Read FAQ401-2487 first!
Do you have a dialog box? If you don't, effectively a cursor doesn't change because a cursor pointed on other windows program like desktop or on explorer. If you have a dialog box a cursor changed when it pass over the dialog box, I try it and it works.
That is fine for when the dialog box is up, but the macro suspends operation until the dialog box is filled in and the 'OK' button is pressed. It's the status of the cursor change (or lack thereof) AFTER that happens (while the macro runs with the parameters passed) that I would want to control. Have you gotten this part to work with the cursor change?
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data" Want good answers? Read FAQ401-2487 first!
The operation are not suspends when a dialog box is up. All events can be control. If you want to compute some operations when a user take a selection in drop down list, you can. You can change a cursor status, take operations and recover an original cursor status, it's easy.
Show help on dialog box.
It's possible that I don't understand what you want to do.
Sorry about the misunderstanding. When the dialog box is up, only dialog events processed through the dialog function can process. The code in the body of the macro does not proceed until the dialog is closed. This is where the majority of the activity occurs, and while it is running end users often get confused over whether the macro is executing or not. This is where I would like to have the ease of a simple cursor change, not while the dialog box is up.
I have used the ShowStatus function I mentioned, but some of my clients do not allow ActiveX controls to be registered by a user without giving them Admin rights to their computer. This cursor change would give them some indication the macro is running without requiring that change.
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data" Want good answers? Read FAQ401-2487 first!
Thanks Roland for your precision on your function.
Dave, if the process occurs before a dialog box is open, is it possible to put this process in a initialize status of dialog box(where operation% = 1). In this case, you can change cursor appearance and, if is possible, you can put a message that says initialisation occurs.
I'll give it a try, but I'm not optimistic. My testing thus far has not gone well.
Roland,
What I am looking for is an easy way to let the end-user know the macro is still running. Currently, if the macro is calling a long stored procedure, creating a long ascii file, or running Impromptu with a long report in non-visible mode, they tend to think it failed and start it again. When I try this with this cursor change it works fine as long as there is no interface (dialog or msgbox) but doesn't change the cursor if there is.
I'll keep plugging away at it. There is no logical reason it shouldn't work.
Regards,
Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data" Want good answers? Read FAQ401-2487 first!
Ok, I think I know where you guys are headed. We needed to hold the cursor state in a static variable so that we could test and set the appropriate cursor in the function.
Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lCursorName As Long) As Long
Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Declare Function GetCursor Lib "user32" () As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function FileDlgFunction(identifier$, action, suppvalue)
Dim button as integer
Dim identifier$
Dim action as Integer
Dim suppvalue as Integer
Begin Dialog newdlg 183, 52, "Show Hide Hour Glass", .FileDlgFunction
OkButton 130, 6, 50, 14
CancelButton 130, 23, 50, 14
CheckBox 29, 11, 62, 15, "Show HourGlass Cursor", .CheckBox1
End Dialog
Dim dlg As newdlg
button = Dialog(dlg)
End Sub
Function FileDlgFunction(identifier$, action, suppvalue)
Static CurCursor As String
On Error resume next
If CurCursor = "Normal" Then
SetMousePointer HOUR_GLASS_CURSOR
Else
SetMousePointer NORMAL_CURSOR
End If
Select Case action
Case 1
Case 2 'user changed control or clicked a button
If DlgControlID(identifier$)=2 then
If CurCursor = "Normal" Then
CurCursor = "HourGlass"
Else
CurCursor = "Normal"
End If
End If
End Select
Also ... I can convert the above sample code to an SBH file (if your interested) and include the whole Cursor logic in a subroutine so that you will have minimal changes to make to your existing programs (ie: just "Include" the SBH file and then reference the subroutine to set the cursor - from anywhere in your code).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.