#include <hmg.ch>
Function Main
define window dummy at 0,0 width 0 height 0 main nocaption nosysmenu on init startmain()
end window
activate window dummy
Return
function startmain
?"Now starting the program."
wait
select printer default preview
start printdoc
start printpage
@ 20,20 print "This is a test print"
end printpage
end printdoc
?"Now ending the program"
wait
endmain()
return nil
function endmain
release window dummy
return nil
East or West HMG is the Best. South or North HMG is worth.
...the possibilities are endless.
#include <hmg.ch>
// here is our main window
function Main()
define window winMain at 0, 0 width 100 height 100 main noshow ;
on init ConsoleMain()
end window
activate window winMain
return nil
// here comes our old clipper / harbour console codes
function ConsoleMain()
clear screen
@ 1, 1 to maxrow()-1, maxcol()-1 double
@ maxrow()-2, 1 say "Press any key to start print preview in console mode ..."
inkey(0)
PrintTest()
clear screen
@ maxrow()-2, 1 say "Print test done. Press any key to quit ..."
inkey (0)
thiswindow.release()
retur nil
// here comes print test
Function PrintTest()
SELECT PRINTER DEFAULT PREVIEW
START PRINTDOC NAME "Print from HMG Console Mode"
START PRINTPAGE
@ 100, 100 print "This is print test from HMG Console Mode"
END PRINTPAGE
END PRINTDOC
return nil
I'm returning to this topic. I want to ask if it's possible to move focus to console and from console to window?
I've used Rathi' sample, it works fine, but after running program, text console doesn't get focus. We need to move to it via ALT-Tab or mouse key.
When I activate window form, focus is still at console...
Marek
The reason is, after we give the command end printdoc the preview window is released, however the dummy window is not released. If we release that window, the application is closed immediately.
I think Roberto can help in this regard.
East or West HMG is the Best. South or North HMG is worth.
...the possibilities are endless.
The reason is, after we give the command end printdoc the preview window is released, however the dummy window is not released. If we release that window, the application is closed immediately.
I think Roberto can help in this regard.
If you want to set the focus to a non HMG generated window (like console) you must code a little of C and WinAPI.
The easier way is to locate the window by his title and then operate on it to (ie) give the focus.
AFAIR, at least one of the Grigory's utilities does it.
I gues that him is the right person to help you here.
mol wrote:I'm returning to this topic. I want to ask if it's possible to move focus to console and from console to window?
I've used Rathi' sample, it works fine, but after running program, text console doesn't get focus. We need to move to it via ALT-Tab or mouse key.
When I activate window form, focus is still at console...
Hi Marek,
Please be so kind to revise the following mixed mode sample: