Automatic RESIZING objects to the system display resolution.

Automatic RESIZING objects to the system display resolution.

Postby avista » Sat Apr 17, 2010 9:50 am

Hi,

I have tried function DISPLAY 2.0 for resizig windows, dialogs … and objects on them … but resizing is going very slow expecially if there are manu objects on the dialog.
So here is my new idea which work perfectly on every display resolution and visual all dialogs windows and objects on them have the same size on any dipslay resolution. Don’t need changes in the source code of the program. I have maded the copy of .CH files and maded changes there.
In the start of the program you need only this:


public sSysSir := 0 // System Width
public sSysVis := 0 // System Height
public sNovSir := 800 // Source Width
public sNovVis := 600 // Source Height
public sSir := 0 // Factor for new Width
public sVis := 0 // Factor for new Height
ScrResolution(@sSysSir,@sSysVis)
sSir := sSysSir / sNovSir
sVis := sSysVis / sNovVis

//------------------------------------------------------------------------//
function sSir(nSir)
if !empty(nSir)
return nSir*sSir
else
return nSir
endif
//------------------------------------------------------------------------//
function sVis(nVis)
if !empty(nVis)
return nVis*sVis
else
return nVis
endif
//------------------------------------------------------------------------//


Changes needed in include files is only to put nRow,nCol,nWidth,nHeight,nTop,nBottom,nLeft,nRight, ... in functions like:
<nRow> need to look like sVis(<nRow>)
<nCol> need to look like sSir(<nCol>)
....

For example:

//----------------------------------------------------------------------------//
#xcommand DEFINE DIALOG <oDlg> ;
[ <resource: NAME, RESNAME, RESOURCE> <cResName> ] ;
[ TITLE <cTitle> ] ;
[ FROM <nTop>, <nLeft> TO <nBottom>, <nRight> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ <lib: LIBRARY, DLL> <hResources> ] ;
[ <vbx: VBX> ] ;
[ STYLE <nStyle> ] ;
[ <color: COLOR, COLORS> <nClrText> [,<nClrBack> ] ] ;
[ BRUSH <oBrush> ] ;
[ <of: WINDOW, DIALOG, OF> <oWnd> ] ;
[ <pixel: PIXEL> ] ;
[ ICON <oIco> ] ;
[ FONT <oFont> ] ;
[ <help: HELP, HELPID> <nHelpId> ] ;
=> ;
<oDlg> = TDialog():New( sVis(<nTop>), sSir(<nLeft>), sVis(<nBottom>), sSir(<nRight>),;
<cTitle>, <cResName>, <hResources>, <.vbx.>, <nStyle>,;
<nClrText>, <nClrBack>, <oBrush>, <oWnd>, <.pixel.>,;
<oIco>, <oFont>, <nHelpId>, sSir(<nWidth>), sVis(<nHeight>) )

//----------------------------------------------------------------------------//
#command @ <nRow>, <nCol> GET [ <oGet> VAR ] <uVar> ;
[ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
[ <memo: MULTILINE, MEMO, TEXT> ] ;
[ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ FONT <oFont> ] ;
[ <hscroll: HSCROLL> ] ;
[ CURSOR <oCursor> ] ;
[ <pixel: PIXEL> ] ;
[ MESSAGE <cMsg> ] ;
[ <update: UPDATE> ] ;
[ WHEN <uWhen> ] ;
[ <lCenter: CENTER, CENTERED> ] ;
[ <lRight: RIGHT> ] ;
[ <readonly: READONLY, NO MODIFY> ] ;
[ VALID <uValid> ] ;
[ ON CHANGE <uChange> ] ;
[ <lDesign: DESIGN> ] ;
[ <lNoBorder: NO BORDER, NOBORDER> ] ;
[ <lNoVScroll: NO VSCROLL> ] ;
=> ;
[ <oGet> := ] TMultiGet():New( sVis(<nRow>), sSir(<nCol>), bSETGET(<uVar>),;
[<oWnd>], sSir(<nWidth>), sVis(<nHeight>), <oFont>, <.hscroll.>,;
<nClrFore>, <nClrBack>, <oCursor>, <.pixel.>,;
<cMsg>, <.update.>, <{uWhen}>, <.lCenter.>,;
<.lRight.>, <.readonly.>, <{uValid}>,;
[\{|nKey, nFlags, Self| <uChange>\}], <.lDesign.>,;
[<.lNoBorder.>], [<.lNoVScroll.>] )

//----------------------------------------------------------------------------//

#xcommand DEFINE FONT <oFont> ;
[ NAME <cName> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ <from:FROM USER> ] ;
[ <bold: BOLD> ] ;
[ <italic: ITALIC> ] ;
[ <underline: UNDERLINE> ] ;
[ WEIGHT <nWeight> ] ;
[ OF <oDevice> ] ;
[ NESCAPEMENT <nEscapement> ] ;
=> ;
<oFont> := TFont():New( <cName>, sSir(<nWidth>), sVis(<nHeight>), [<.from.>],;
[<.bold.>],[<nEscapement>],,[<nWeight>], [<.italic.>],;
[<.underline.>],,,,,, [<oDevice>] )
//------------------------------------------------------------------------//


Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 3 guests