By default, tPreview is opening to MAXIMIZED. One of my clients just got very upset because his new monitor ( 34" ) displays the preview on the entire screen, while the application itself is only taking about 1/3 of the screen.
Is there a system wide setting I can use to have tPreview initialized with the oWnd application screen size setting or do I have to modify tPreview from source ?
Thanks.
Preview Window size
Preview Window size
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Preview Window size
As of now, the only way is to modify rpreview.prg.
Now that you have raised the issue, we will provide a way to customize the size of the preview window in the next version.
Now that you have raised the issue, we will provide a way to customize the size of the preview window in the next version.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Preview Window size
Thank you. It does work with modifying rpreview.prg, but of course that would require the modification every time a new release was provided. Having it for the next version will be appreciated.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Preview Window size
it is not necessarily correct you can use a function of yours instead of the activate method without changing the original classAs of now, the only way is to modify rpreview.prg.
Tim
you must call this at the init of your application
on Myactivatefunction you put your activate function
now I copied all activate method but U can modify the function Myactivatefunction with your configuration
so the original class remains intact and you can change the various methods you want
#include "FiveWin.ch"
#include "report.ch"
#xcommand OVERRIDE METHOD <!Message!> [IN] CLASS <!Class!> ;
WITH [METHOD] <!Method!> [SCOPE <Scope>] => ;
__clsModMsg( <Class>():classH, #<Message>, @<Method>() )
function myfunc_override()
OVERRIDE METHOD Activate() IN CLASS TPreview WITH Myactivatefunction
return nil
Function Myactivatefunction()
local Self := HB_QSelf()
local hWndMain
if ::oWnd == nil
return nil
endif
if ::bSetUp != nil
Eval( ::bSetUp, Self, ::oWnd )
endif
ACTIVATE WINDOW ::oWnd MAXIMIZED ;
ON RESIZE ( ::PaintMeta(), ::ResizeListView() ) ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oCursor:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
If( Empty( ::oImageList ),, ( ::oImageList:End(), ::oImageList := nil ) ),;
If( ! Empty( ::oImageListPages ), ::oImageListPages:End(),),;
::oWnd := nil ,;
::oDevice:oPreview := nil ,;
::lExit := .T. )
if ::oDevice:lPrvModal
if ::oWndMain == nil
StopUntil( { || ::lExit } )
else
hWndMain := WndMain():hWnd
StopUntil( { || ::lExit .or. !IsWindow( hWndMain ) } )
endif
endif
return nil
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Preview Window size
timTimStone wrote:By default, tPreview is opening to MAXIMIZED. One of my clients just got very upset because his new monitor ( 34" ) displays the preview on the entire screen, while the application itself is only taking about 1/3 of the screen.
Is there a system wide setting I can use to have tPreview initialized with the oWnd application screen size setting or do I have to modify tPreview from source ?
Thanks.
let me see the comand you use to call rpreview or printer class
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Preview Window size
Silvio,
I just modified the rpreview.prg and linked it in.
In the Activate clause I simply changed Maximized to CENTERED
In the DEFINE WINDOW, I added. FROM 0,0 TO 900, 1150 PIXEL ;
It now works perfectly, and of course applies to all PREVIEW calls.
Like other options we can set with a single command line at the beginning of the program, I'm sure Nages will provide a very simple solution for us in the next release.
Thanks for the input. I will keep it in mind for other situations.
Tim
I just modified the rpreview.prg and linked it in.
In the Activate clause I simply changed Maximized to CENTERED
In the DEFINE WINDOW, I added. FROM 0,0 TO 900, 1150 PIXEL ;
It now works perfectly, and of course applies to all PREVIEW calls.
Like other options we can set with a single command line at the beginning of the program, I'm sure Nages will provide a very simple solution for us in the next release.
Thanks for the input. I will keep it in mind for other situations.
Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Preview Window size
but now you've changed it and every time you have to change it.
If there will be updates in the Rpreview class you still need to change the class for your needs.
instead with my method it is easier and painless because even there will be updates using the override set your function
without changing the original class
you sad me you modify the rpreview.prg with
"DEFINE WINDOW, I added. FROM 0,0 TO 900, 1150 PIXEL" and change activate methods
it is easy...
I tried aand run ok here
I add also checkstyle function with no changes because it make erro ron nstyle = nil
on my applications I changed different method of RPreview or another classes
I change the buttonbar,listview,menu and other methods without change the original class
Remember to put the Ut_override() before at init on main of your application
If there will be updates in the Rpreview class you still need to change the class for your needs.
instead with my method it is easier and painless because even there will be updates using the override set your function
without changing the original class
you sad me you modify the rpreview.prg with
"DEFINE WINDOW, I added. FROM 0,0 TO 900, 1150 PIXEL" and change activate methods
it is easy...
Code: Select all
#include "FiveWin.ch"
#include "report.ch"
#xcommand OVERRIDE METHOD <!Message!> [IN] CLASS <!Class!> ;
WITH [METHOD] <!Method!> [SCOPE <Scope>] => ;
__clsModMsg( <Class>():classH, #<Message>, @<Method>() )
static bUserBtns, lRebar, nBtnW, nBtnH, nStyle
static lWord, lCalc
function Ut_override()
OVERRIDE METHOD BuildWindow IN CLASS TPreview WITH PreviewBuildWindow
OVERRIDE METHOD Activate IN CLASS TPreview WITH PreviewActivate
OVERRIDE METHOD CheckStyle IN CLASS TPreview WITH PreviewCheckStyle
return nil
Function PreviewBuildWindow()
local Self := HB_QSelf()
local lRebar := .t.
local oIcon, cTitle := FWString( "Printing Preview" )
local oBar, nCol := 420
local oThis := Self, nRow := 7, nHelpID
if Len( ::oDevice:aMeta ) < 1
return nil
endif
DEFAULT ::oWndMain := WndMain()
if ::oDevice != nil
cTitle = ::oDevice:cDocument
endif
if ::oWndMain != nil
oIcon = ::oWndMain:oIcon
else
DEFINE ICON oIcon RESOURCE "Print"
ENDIF
DEFINE FONT ::oFont NAME GetSysFont() SIZE 0, -12
::CheckStyle()
if (::oReport != nil) // dfl 1712
nHelpId := ::oReport:nHelpId
endif
if ! ::oDevice:lPrvModal .and. ::oWndMain != nil .and. ;
Upper( ::oWndMain:ClassName() ) == "TMDIFRAME"
DEFINE WINDOW ::oWnd FROM 0,0 TO 900, 1150 ;
TITLE cTitle ;
COLOR CLR_BLACK,CLR_LIGHTGRAY ;
HELPID nHelpId ; // dfl 1712
VSCROLL HSCROLL MDICHILD
else
DEFINE WINDOW ::oWnd FROM 0,0 TO 900, 1150 ;
TITLE cTitle ;
COLOR CLR_BLACK,CLR_LIGHTGRAY ;
HELPID nHelpId ; // dfl 1712
VSCROLL HSCROLL MENU ::BuildMenu()
ENDIF
::oWnd:SetIcon( oIcon )
::oWnd:SetFont( ::oFont )
::oWnd:oVScroll:SetRange( 0, 0 )
::oWnd:oHScroll:SetRange( 0, 0 )
::cPageNum = FWString( "Page number:" )
::BuildButtonBar()
if lRebar
DEFINE STATUSBAR OF ::oWnd PROMPT " " + FWString( "Preview" )
else
SET MESSAGE OF ::oWnd TO FWString( "Preview" ) CENTERED ;
NOINSET CLOCK DATE KEYBOARD
::oWnd:oMsgBar:l2007 := ( nStyle == 2007 )
::oWnd:oMsgBar:l2010 := ( nStyle == 2010 )
endif
// We build the left thumbs listview
if ! ::lListViewHide
::BuildListView()
endif
// We build the main metafiles to display the pages
::oMeta1 := TMetaFile():New( 0, 0, 0, 0,;
::oDevice:aMeta[ 1 ],;
::oWnd,;
CLR_BLACK,;
CLR_WHITE,;
::oDevice:nHorzRes(),;
::oDevice:nVertRes() )
DEFINE CURSOR ::oCursor SEARCH
::oMeta1:oCursor := ::oCursor
::oMeta1:blDblClick := { | nRow, nCol, nKeyFlags | ;
::SetOrg1( nCol, nRow, nKeyFlags ),;
If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }
::oMeta1:bKeyDown := { | nKey, nFlags | ::CheckKey( nKey, nFlags ) }
::oMeta1:bKeyChar := { |k| If( k == 16, ( If( ValType( ::bPrint ) == 'B', Eval( ::bPrint, Self ), ::PrintPage() ), 0 ), nil ) }
::oMeta1:bMouseWheel := { | nKeys, nDelta, nXPos, nYPos | ;
::CheckMouseWheel( nKeys, nDelta, nXPos, nYPos ) }
::oMeta2 := TMetaFile():New( 0, 0, 0, 0, "",;
::oWnd, CLR_BLACK, CLR_WHITE, ::oDevice:nHorzRes(),;
::oDevice:nVertRes() )
::oMeta2:oCursor = ::oCursor
::oMeta2:blDblClick := { | nRow, nCol, nKeyFlags | ;
::SetOrg2( nCol, nRow, nKeyFlags ),;
If ( ::lListViewHide, nil, If( ::lZoom, ::oLvw:Hide(), ::oLvw:Show() ) ) }
::oMeta2:hide()
::SetFactor()
oBar := ::oBar
if ::bButtonBar == nil
if .T. // ! lRebar
nCol := If( ! Empty( oBar:aControls ), ATail( oBar:aControls ):nRight, Len( oBar:aButtons ) * ( oBar:nBtnWidth + 2 ) ) + 30
nRow := Int( oBar:nHeight / 2 ) - 8
endif
::CheckStyle()
if nStyle >= 2007
oBar:bPainted = { || oBar:Say( nRow, nCol, "Factor:",,, ::oFont, .T., .T. ),;
oBar:Say( nRow, nCol+100, ::cPageNum + " " + ;
LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
LTrim( Str( Len( ::oDevice:aMeta ) ) ),,, ::oFont, .T., .T. ) }
endif
if nStyle < 2007
@ nRow, nCol SAY ::oSay PROMPT "Factor:" ;
SIZE 45, 15 PIXEL OF ::oBar FONT ::oFont
::oSay:lTransparent = .T.
endif
@ nRow - 4, nCol + 40 COMBOBOX ::oFactor VAR ::nZFactor ;
ITEMS { "1", "2", "3", "4", "5", "6", "7", "8", "9" } ;
OF ::oBar FONT ::oFont PIXEL SIZE 35,200 ;
ON CHANGE oThis:SetFactor( oThis:nZFactor )
if nStyle < 2007
@ nRow, nCol + 100 SAY ::oPage PROMPT FWString( "Page number:" ) + ;
LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
LTrim( Str( Len( ::oDevice:aMeta ) ) ) ;
SIZE 180, 15 PIXEL OF ::oBar FONT ::oFont
::oPage:lTransparent = .T.
endif
if lRebar .or. nStyle >= 2007
#define NULL_BRUSH 5
FixSays( ::oBar:hWnd, GetStockObject( NULL_BRUSH ) )
endif
::oFactor:Set3dLook( .T. )
endif
::oWnd:oHScroll:bPos := { | nPos | ::HScroll( GO_POS, .f., nPos ) }
::oWnd:oVScroll:bPos := { | nPos | ::VScroll( GO_POS, .f., nPos ) }
return nil
//---------------------------------------------------------------------------------------
Function PreviewActivate()
local Self := HB_QSelf()
local hWndMain
if ::oWnd == nil
return nil
endif
if ::bSetUp != nil
Eval( ::bSetUp, Self, ::oWnd )
endif
ACTIVATE WINDOW ::oWnd CENTERED ;
ON RESIZE ( ::PaintMeta(), ::ResizeListView() ) ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oCursor:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
If( Empty( ::oImageList ),, ( ::oImageList:End(), ::oImageList := nil ) ),;
If( ! Empty( ::oImageListPages ), ::oImageListPages:End(),),;
::oWnd := nil ,;
::oDevice:oPreview := nil ,;
::lExit := .T. )
if ::oDevice:lPrvModal
if ::oWndMain == nil
StopUntil( { || ::lExit } )
else
hWndMain := WndMain():hWnd
StopUntil( { || ::lExit .or. !IsWindow( hWndMain ) } )
endif
endif
return nil
Function PreviewCheckStyle()
local Self := HB_QSelf()
local o
if nStyle == nil
nStyle := 0
DEFAULT ::oWndMain := WndMain()
if ::oWndMain != nil
if ( o := ::oWndMain:oMenu ) != nil
nStyle := Max( nStyle, If( o:l2010, 2010, 0 ) )
endif
if nStyle < 2010 .and. ( o := ::oWndMain:oMsgBar ) != nil
nStyle := Max( nStyle, If( o:l2010, 2010, If( o:l2007, 2007, 0 ) ) )
endif
if nStyle < 2010 .and. ( o := ::oWndMain:oTop ) != nil
if o:IsKindOf( "TRIBBONBAR" )
nStyle := Max( nStyle, If( o:l2010, 2010, 2007 ) )
elseif o:IsKindOf( "TBAR" )
nStyle := Max( nStyle, If( o:l2010, 2010, 2007 ) )
if Empty( nStyle ) .and. Len( o:aControls ) > 0 .and. o:aControls[ 1 ]:l97look
nStyle := 97
endif
endif
endif
endif
endif
lRebar := ( IsAppThemed() .and. Empty( nStyle ) .and. bUserBtns == nil .and. nBtnW == nil .and. nBtnH == nil )
return Self
I add also checkstyle function with no changes because it make erro ron nstyle = nil
on my applications I changed different method of RPreview or another classes
I change the buttonbar,listview,menu and other methods without change the original class
Remember to put the Ut_override() before at init on main of your application
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC