Print preview in HMG Console mode
Moderator: Rathinagiri
Print preview in HMG Console mode
Hello All,
Is there any way to preview the reports in console mode of HMG?
Just now one of my friends (Mr. Manohar Maski) asked me how to see print preview with HMG in console mode. I don't know.
He used SELECT PRINTER command and is very happy to see his old Clipper app is now printing on Windows printers
Thanks in advance.
Is there any way to preview the reports in console mode of HMG?
Just now one of my friends (Mr. Manohar Maski) asked me how to see print preview with HMG in console mode. I don't know.
He used SELECT PRINTER command and is very happy to see his old Clipper app is now printing on Windows printers
Thanks in advance.
With best regards,
Sudip
Sudip
Re: Print preview in HMG Console mode
Hi Sudip,
Please take a look:
http://hmgforum.com/viewtopic.php?f=5&t=1504
Maybe this will help to you
Best Regards
Javier
Please take a look:
http://hmgforum.com/viewtopic.php?f=5&t=1504
Maybe this will help to you
Best Regards
Javier
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Print preview in HMG Console mode
With Javier's help, I had created a small sample. I think this would work.
Code: Select all
#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.
South or North HMG is worth.
...the possibilities are endless.
Re: Print preview in HMG Console mode
Fine example. Till now, I thought it isn't possible because of not activation main window.
Thanks, Rathi!
Thanks, Rathi!
Last edited by mol on Mon Sep 20, 2010 5:27 am, edited 1 time in total.
Re: Print preview in HMG Console mode
Hello,
Thank you Rathi.
Here is my code: (some idea taken from J.Parada and I wrote it before seeing Rathi's code.)
Thank you Rathi.
Here is my code: (some idea taken from J.Parada and I wrote it before seeing Rathi's code.)
Code: Select all
#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
With best regards,
Sudip
Sudip
Re: Print preview in HMG Console mode
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
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
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Print preview in HMG Console mode
I am afraid it is not possible.
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.
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.
South or North HMG is worth.
...the possibilities are endless.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Print preview in HMG Console mode
If you want to set the focus to a non HMG generated window (like console) you must code a little of C and WinAPI.rathinagiri wrote:I am afraid it is not possible.
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.
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.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Print preview in HMG Console mode
Hi Marek,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...
Please be so kind to revise the following mixed mode sample:
Code: Select all
#include "minigui.ch"
Function Main
SET STATIONNAME TO "MAINPROC"
_HMG_Commpath:= GetCurrentFolder()+"\"
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'Harbour MiniGUI Demo' ;
MAIN ;
FONT 'Arial' SIZE 10
DEFINE LABEL Label1
ROW 10
COL 10
VALUE "Good morning"
END LABEL
DEFINE GETBOX Box11
ROW 10
COL 100
VALUE 2.5
PICTURE '999,999,999,999.9999'
END GETBOX
DEFINE BUTTON Btn1
ROW 50
COL 10
CAPTION 'DOS 1'
ACTION THIS.CAPTION:=ALLTRIM(STR(GETDATA(FN1())))
END BUTTON
DEFINE BUTTON Btn2
ROW 100
COL 10
CAPTION 'Message'
ACTION FN2(3)
END BUTTON
DEFINE BUTTON Btn4
ROW 150
COL 10
CAPTION 'EXIT'
ACTION Form_1.release
END BUTTON
END WINDOW
HideConsole()
Form_1.Center()
Form_1.Activate()
Return Nil
FUNCTION FN1()
LOCAL r1 := 0
LOCAL r2 := 0
MEMVAR GetList
HIDE WINDOW Form_1
ShowConsole()
CLEAR SCREEN
@ 10,10 SAY ' S1 ' GET r1 pict '9999'
@ 12,10 SAY ' S2 ' GET r2 pict '9999'
READ
SENDDATA("MAINPROC",R2)
HideConsole()
RESTORE WINDOW Form_1
RETURN NIL
FUNCTION FN2(n)
LOCAL i
HIDE WINDOW Form_1
ShowConsole()
CLEAR SCREEN
FOR i:=1 TO n
?i
NEXT
WAIT
HideConsole()
RESTORE WINDOW Form_1
MsgBox('bla'+TRANSFORM(n,'99'),'Title')
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( HIDECONSOLE )
{
ShowWindow(( HWND) FindWindow( NULL, "demo" ), SW_MINIMIZE);
}
HB_FUNC( SHOWCONSOLE )
{
ShowWindow(( HWND) FindWindow( NULL, "demo" ), SW_RESTORE);
}
#pragma ENDDUMP
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Print preview in HMG Console mode
Nice example Grigory. Thanks.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.