I've recompiled an old QuickWin project.
It uses a dialog to specify some parameters then draws graphics in the full screen, then displays the dialog again with the results.
I'm finding that the dialog is losing focus and is behind the graphics. If I click on the screen the dialog is displayed.
How do I set focus to the dialog using Quickwin?
I have tried:
But I have a note that it didn't work before and it doesn't work this time.
Maybe the solution is to rewrite it as a proper Windows application.
Thanks, I had seen the documentation for focusQQ but wasn't sure what parameter I send - the example give a unit number.
where IDC_JOB3 is the dialog I want to get focus.
Looking at examples they have:
OPEN (UNIT= 12, FILE= 'USER', TITLE= 'Product Matrix')
to open a window - this gives something like a command line box with simple text.
I have a proper dialog box with labels, text boxes & buttons. The only OPEN statements I have are to OPEN files to for read & write.
Therefore I'm not sure where I get this Unit number from.
Sound like you have dialogs and the Quickwin frame window (usually with menus). The unit number of the frame window is in the constant QWIN$FRAMEWINDOW
Thanks for your help. I tried adding
but it had no effect.
I think a screen dump might help to show what is going on.
I have a dialog box where I enter some info, when I press 'Calculate' an image is then drawn on the frame window. At the end I want the dialog box to reappear showing the results. I have to click on the frame window and the dialog reappears. I have shown a screen dump showing the result after clicking on the frame window.
I think I need to be setting focus to the dialog box not the frame window.
You can set the window Z order with an API call
!(ivert) hWndInsertAfter Either the handle of the window to position this window behind, or exactly one
! of the following flags stating where in the Z-order to put the window:
!HWND_BOTTOM = 1 ! Put the window at the bottom of the Z-order.
!HWND_NOTOPMOST =-2 ! Put the window below all topmost windows and above all non-topmost windows.
!HWND_TOP = 0 ! Put the window at the top of the Z-order.
!HWND_TOPMOST = -1 ! Make the window topmost (above all other windows) permanently
I have not used quickwin for a long time but that seems strange. Modal dialogs created with IFLOGM I recall were always higher z order than the parent window. Do you create this dialog with DLGMODAL or DLGMODELESS by the way?
Thanks, I tried that code but nothing happened (maybe I didn't do it right)
I'm calling the dialog using DlgModal.
I think I will try to convert the program from QuickWin to an proper Windows Application. That will make it more consistent with other programs in the suite.
This should be an easy problem to fix.
What is the program flow I guess:
1) program create frame window
2) Create dialog via initialsettings and goes model?
3) In dialog callback routine to some user input e.g. button press) you draw to the frame window (?? using api or quickwin?)
4) At 3) frame window comes to top and on completion of callback drawing stays there.
Some bits of code might help, where are you trying to set focus/ z order. Just saying it didn't work doesn't give much option for anyone to help / comment.
When I started looking at this the other day it was displaying the frame window in front of the dialog window so I couldn't start entering the info on the dialog.
I therefore moved the 'Create frame window' to after creating the Dialog.
After the change, I could at least enter the data but then was not able to see the results at the end.
From your suggested order, changing it back to what it was has worked.
When I say it works, is when the dialog is in front of the frame, saying it doesn't work means that the dialog is displayed behind the frame window.
I have taken a previous backup of the code and compiled it and it 'works' first time without any changes, i.e. the dialog is displayed in front of the frame as required.
I don't know what went wrong but it is now OK.
Thanks for your help.