Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Changing the mouse cursor in Qwin

Neels
New Contributor II
767 Views

I tried changing the mouse cursor to an hour glass shape (IDC_WAIT) as per the example in the documentation (User and Reference Guide for the Intel® Fortran Compiler 15.0) except it is for a full Qwin and not Standard Graphics but it does not change unless I have a read statement following the SetMouseCursor statement. How do I get it to change without the read statement?

0 Kudos
13 Replies
Steven_L_Intel1
Employee
767 Views

Have you tried DISPLAYCURSOR($GCURSORON)  ?

0 Kudos
Neels
New Contributor II
767 Views

Yes, but it does not solve it. I also tried SleepQQ.

0 Kudos
andrew_4619
Honored Contributor III
767 Views

Is it because the read operation gives the windows focus? Try calling focusqq / setactiveqq

0 Kudos
Neels
New Contributor II
767 Views

Thanks, I already have both those in.

0 Kudos
andrew_4619
Honored Contributor III
767 Views

Have you go a sample program,  I looked at the sample at #1 but I am guessing you need an 'event' in the window before the cursor change kicks in. What does your program sample do after the cursor change? Without the 'read' in the sample the program would terminate so do you have some menu or other control mechanism?

Maybe registering a mouse event for mouse motion after the cursor change and have the call back de register it might work...

 

 

0 Kudos
Neels
New Contributor II
767 Views

This is part of a bigger program, this part goes to the child windo and after activating it, focussing it, loading the cursor, and sleeping for a bit it does a large number of iterations before displaying the results in graph form in this child window.

Sorry no smaller sample.

I will see what the mouse event does, thanks.

0 Kudos
andrew_4619
Honored Contributor III
767 Views

So after the cursor change as far as the windows message pump is concerned the window is inactive/unresponsive whist you are waiting or doing sums.... Registering mouse events might solve the issue.....

0 Kudos
Neels
New Contributor II
767 Views

Thanks, I was planning to do that next after your reply #6. Will report back.

0 Kudos
Neels
New Contributor II
767 Views

WaitOnMouseEvent does it except it does not move on from there.

I seem to recall somewhere, I think maybe in a DVF or CVF sample program there was some trick used to simulate a mouse event. Does anyone recall that or am I dreaming? (Seems to happen often that.)

0 Kudos
andrew_4619
Honored Contributor III
767 Views

Don't know in quickwin but something like this should work:

subroutine mouser(lu)
    use ifwin, only: bool, handle, postmessage, WM_LBUTTONDOWN, fwparam, flparam
    use ifqwin, only: GETHWNDQQ
    integer, intent(in) :: LU ! quickwin child window unit nuber assumed open
    integer(handle)     :: Hwnd
    integer(bool)       :: bret
    
    Hwnd = GETHWNDQQ (lu)
    !simulate a left mouse button down at 0,0 (coord is hi and low words of 0_flparam)
    if (Hwnd /= 0 ) bret = PostMessage(hWnd, WM_LBUTTONDOWN, 0_fwparam, 0_flparam)
end subroutine mouser

 

0 Kudos
andrew_4619
Honored Contributor III
767 Views

Can that  last post WaitOnMouseEvent is blocking so you can't do anything sensible in quickwin with that....

You need registermousevent which is not blocking. Your callback for this will process from the quickwin message thread not the child window thread.

if you register all mouse events and mouse action over the window will trigger an event. Your callback can probably no nothing exept unregister the mouse event....

 

 

0 Kudos
Neels
New Contributor II
767 Views

if you register all mouse events and mouse action over the window will trigger an event. Your callback can probably no nothing exept unregister the mouse event....

This is exactly what I did but for some reason the qwin thread does not resume.

0 Kudos
andrew_4619
Honored Contributor III
767 Views

is all this stuff happening within a callback from a quickwin menu item? I haven't used quickwin for some time but I am recalling now that  you are only processing mouse events  when you have return control to the message loop. For example, I recall when wanting a location click in a child window from a modal dialog I would have to close the dialog, grab the mouse event and the restart the dialog. Out of ideas on this one sorry.

If you are just trying to indicate busy perhaps there is an easier way. Attaching a progress bar to the child window for example or some periodic progress message text to the child window.

 

 

 

0 Kudos
Reply