WILIAM;
YA LOGRÉ QUE TRABAJARA (A MEDIAS), PERO NO CORRIGE LA RESOLUCIÓN DEL WINDOW PRINCIPAL NI DEL MENÚ PRINCIPAL.
EXCEPTUANDO POR ESO, ESTÁ MUY BIÉN.
NO SERÍA BUENO QUE EL FIVEWIN TUVIERA UNA CLÁUSULA PARA DEFINIR LA RESOLUCIÓN DE DISEÑO Y LA RESPETARA EN TODO EL DESARROLLO (OPCIONAL)
APORTE: FUNCTION DISPLAY 2.0
Re: APORTE: FUNCTION DISPLAY 2.0
Saludos
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Angel, Valencia, Venezuela
xH .997 - FW 7.9 - BCC55 - WorkShop - MySql
Re: APORTE: FUNCTION DISPLAY 2.0
Hola,
He estado trabajando con la funcion Display y he incrporado alguna funcionalidad.
- En la funcion se tiene como obligatorio el definir font en cada control. He realizado algun cambio y no es necesario poner font en cada control, utiliza el defecto.
- Otro cambio realizado consiste en posibilidad de usar la opcion de centrado en Activate del Dialogo (clausula Centered).
Aqui tienen la funcion con las modificaciones (Identificadas con // *** AAA ***//).
Saludos,
Jose Alfonso
He estado trabajando con la funcion Display y he incrporado alguna funcionalidad.
- En la funcion se tiene como obligatorio el definir font en cada control. He realizado algun cambio y no es necesario poner font en cada control, utiliza el defecto.
- Otro cambio realizado consiste en posibilidad de usar la opcion de centrado en Activate del Dialogo (clausula Centered).
Aqui tienen la funcion con las modificaciones (Identificadas con // *** AAA ***//).
Saludos,
Jose Alfonso
Code: Select all
#include "FiveWin.ch"
#include "common.ch"
#include "xbrowse.ch"
*********************************************************************
* NOME......: DISPLAY(oWnd,nResolution)
*
* VERSAO....: 2.0 - Setembro de 2009
*
* AUTOR.....: William de Brito Adami e FiveWidi, que iniciou este projeto
* no Forum Espanhol de Fivewin .
*
* DESCRICAO.: Funcao para exibir a tela sempre igual em qualquer
* resolucao, independente da fonte ou controle utilizado.
*
* PARAMETROS: oWnd: Window ou Dialog a ser redimensionado
* nResolution: Numero correspondente a resolucao
* que se desenhou inicialmente a tela.
*
*********************************************************************
function display( oWnd, nResolution )
local lAutoresize:=.t. , nWhatSize:=0, lRepaint:=.t.
* atencao: nResolution identifica em que resolucao foram inicialmente
* desenhadas as telas, e DEVE ter um dos seguintes valores:
*
* 1 = 640 X 480
* 2 = 800 X 600
* 3 = 1024 X 768
* 4 = 1152 X 864
* 5 = 1280 X 800
* 6 = 1280 X 1024
* 7 = 1600 X 1200
* 8 = 768 X 1024
* 9 = 1440 X 900
* 10 = 1280 X 768
* 11 = 1280 X 720
AutResiz( lAutoresize, nWhatSize, oWnd, nResolution, lRepaint )
return nil
/*
(20/08/2009) Inicio do REdesenvolvimento da funcao.
Parametros recebidos :
lAutoresize: ativa / desativa redimensionamento automatico
nWhatSize: permite for‡ar o redimensionamento a valores concretos;
permitindo desta maneira que a aplica‡ao possa ter um valor
ao qual redimensionar as telas.
oWnd: Objeto/janela/dialogo/controle a ser redimensionado.
nResolution: Numero que identifica que resolucao tinha a tela na qual
se desenhou o objeto.
lRepaint: Indicador se deve repintar o objeto uma vez redimensionado.
Esta funcao deve ser utilizada no evento ON INIT do ACTIVATE das WINDOWs
e DIALOGs .
Exemplo:
ACTIVATE DIALOG oDlg ON INIT display(oDlg,2) //desenhada em 800 X 600
-* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
*/
FUNCTION AutResiz( lAutoresize, nWhatSize, oWnd, nResolution, lRepaint )
// Resolucao da tela no momento de definir os controles.
Local nOriWidth, nOriHeight
// o normal seria que fosse a resolucao atual da tela (nWhatSize=0).
// Se permite forcar esta resolucao mediante o valor de nWhatSize=1,2,3,4,5,6,7,....
Local nWidth, nHeight
// Sao as relacoes entre a resolucao de tela e a resolucao de desenho.
Local nFactorWitdh, nFactorHeight
Local nContador
DEFAULT lRepaint := .T.
nOriWidth := 0
nOriHeight := 0
nWidth := 0
nHeight := 0
nContador := 0
If ABS(nResolution) = 1
nOriWidth := 640
nOriHeight := 480
ElseIf ABS(nResolution) = 2
nOriWidth := 800
nOriHeight := 600
ElseIf ABS(nResolution) = 3
nOriWidth := 1024
nOriHeight := 768
ElseIf ABS(nResolution) = 4
nOriWidth := 1152
nOriHeight := 864
ElseIf ABS(nResolution) = 5
nOriWidth := 1280
nOriHeight := 800
ElseIf ABS(nResolution) = 6
nOriWidth := 1280
nOriHeight := 1024
ElseIf ABS(nResolution) = 7
nOriWidth := 1600
nOriHeight := 1200
ElseIf ABS(nResolution) = 8
nOriWidth := 768
nOriHeight := 1024
ElseIf ABS(nResolution) = 9
nOriWidth := 1440
nOriHeight := 900
ElseIf ABS(nResolution) = 10
nOriWidth := 1280
nOriHeight := 768
ElseIf ABS(nResolution) = 11
nOriWidth := 1280
nOriHeight := 720
Else
ScrResolution( @nOriWidth, @nOriHeight )
Endif
If nWhatSize = 1
nWidth := 640
nHeight := 480
ElseIf nWhatSize = 2
nWidth := 800
nHeight := 600
ElseIf nWhatSize = 3
nWidth := 1024
nHeight := 768
ElseIf nWhatSize = 4
nWidth := 1152
nHeight := 864
ElseIf nWhatSize = 5
nWidth := 1280
nHeight := 800
ElseIf nWhatSize = 6
nWidth := 1280
nHeight := 1024
ElseIf nWhatSize = 7
nWidth := 1600
nHeight := 1200
ElseIf nWhatSize = 8
nWidth := 768
nHeight := 1024
ElseIf nWhatSize = 9
nWidth := 1440
nHeight := 900
ElseIf nWhatSize = 10
nWidth := 1280
nHeight := 768
ElseIf nWhatSize = 11
nWidth := 1280
nHeight := 720
Else
ScrResolution( @nWidth, @nHeight )
Endif
If lAutoresize .and. nOriHeight != nHeight
/* Este sera o caso habitual, ao qual se pretende redimensionar
os controles na resolucao da tela na qual estao viendo. */
If nResolution > 0
nFactorWitdh := nWidth / nOriWidth
nFactorHeight := nHeight / nOriHeight
/* Este sera o caso no qual se pretende desfazer o redimensionamiento
dos controles realizado previamente. */
ElseIf nResolution < 0
nFactorWitdh := nOriWidth / nWidth
nFactorHeight := nOriHeight / nHeight
EndIf
If lRepaint
oWnd:Hide()
EndIf
* se aumentou a altura
If nFactorHeight > 1
*****************************
* se tiver barbutton * NOVO *
*****************************
if ownd:obar <> NIL
ownd:obar:nwidth:=ownd:obar:nwidth* nfactorwitdh
ownd:obar:nHeight:=ownd:obar:nHeight*nfactorheight
ownd:obar:nbtnwidth:=ownd:obar:nbtnwidth*nfactorwitdh
ownd:obar:nbtnHeight:=ownd:obar:nbtnHeight*nfactorheight
for i= 1 to len(ownd:obar:acontrols)
ownd:obar:acontrols[i]:Move( ownd:obar:acontrols[i]:nTop * nFactorHeight , ;
ownd:obar:acontrols[i]:nLeft * nFactorWitdh, ;
ownd:obar:acontrols[i]:nWidth * nFactorWitdh, ;
ownd:obar:acontrols[i]:nHeight * nFactorHeight , ;
.F. )
next
ownd:obar:refresh()
endif
If oWnd:ClassName()$"/TTOOLBAR/"
* AINDA NAO FUNCIONOU !
** msgalert(ownd:oimagelist:abitmaps[1]:nwidth )
*oWnd:nWidth:= oWnd:nWidth * nFactorWitdh
*oWnd:nHeight:= oWnd:nHeight * nFactorHeight
* newwit:= oWnd:nBtnWidth * nFactorWitdh
* newhei:= oWnd:nBtnHeight * nFactorHeight
* for i = 1 to len(ownd:oimagelist:abitmaps)
* newwit:= ownd:oimagelist:abitmaps[i]:nwidth * nFactorWitdh
* newhei:= ownd:oimagelist:abitmaps[i]:nheight * nFactorHeight
* ownd:oimagelist:abitmaps[i]:nwidth:= ownd:oimagelist:abitmaps[i]:nwidth*nfactorwitdh
* ownd:oimagelist:abitmaps[i]:nheight:=ownd:oimagelist:abitmaps[i]:nheight*nfactorheight
* ownd:oimagelist:abitmaps[i]:= resizebmp( ownd:oimagelist:abitmaps[i], newwit, newhei )
*msgalert(ownd:oimagelist:abitmaps[i])
* next
* hBmp := resizebmp( hBmp, ::nWidth, ::nHeight )
/*
* troca imagelist
oWnd:AddButton( { || oWnd:nBtnWidth := 50, oWnd:nBtnHeight := 50,;
ownd:oImagelist:End(), ;
SendMessage( oWnd:hWnd, 1072, 0, ownd:hImageList ),;
oWnd:Refresh() }, "Users management", "Users" )
*/
* OwND:REFRESH()
ElseIf oWnd:ClassName()$"/TIMAGE/TBITMAP/TLISTBOX/TWBROWSE/TSSAY/TDSAY/TSAYREF/"
ad:=getcoors(ownd:hWnd)
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
((ad[4]-ad[2])) * nFactorWitdh, ;
((ad[3]-ad[1])) * nFactorHeight , ;
.F. )
oWnd:refresh()
Else
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight * nFactorHeight , ;
.F. )
EndIf
EndIf
If oWnd:ClassName()$"/TFOLDER/TPAGES/"
If ValType( oWnd:aDialogs ) = "A"
For nContador := 1 To Len( oWnd:aDialogs )
AutResiz( lAutoresize, nWhatSize, oWnd:aDialogs[nContador], nResolution, .F. )
EndFor
EndIf
elseif oWnd:ClassName()$"/TCOMBOBOX/TDBCOMBO/"
elseif oWnd:ClassName()$"/TIMAGE/"
Else
If ValType( oWnd:aControls ) = "A"
For nContador := 1 To Len( oWnd:aControls )
AutResiz( lAutoresize, nWhatSize, oWnd:aControls[nContador], nResolution, .F. )
* ajuste de fontes
* controle TSAY
if ownd:acontrols[nContador]:classname$"/TSAY/TSAYREF/"
ajustaalt(ownd:acontrols[nContador])
ajustalarg(ownd:acontrols[nContador],ownd)
ELSEif ownd:acontrols[nContador]:classname$"/TGET/TDSAY/TSSAY/"
ajustaalt(ownd:acontrols[nContador])
aj_get(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TFOLDER/TPAGES/TCOMBOBOX/TGROUP/TTREE/TCHECKBOX/TBTNBMP/TTOOLBAR/TRADIO/TDBCOMBO/TTABS/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TXBROWSE/"
aja_XBRW(ownd:acontrols[nContador],nFactorHeight)
ajl_XBRW(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TSBROWSE/"
aja_TSB(ownd:acontrols[nContador],nFactorHeight)
ajl_TSB(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TWBROWSE/"
aja_OLBX(ownd:acontrols[nContador],nFactorHeight)
ajl_OLBX(ownd:acontrols[nContador],nFactorWitdh)
endif
EndFor
EndIf
EndIf
* se diminuiu a altura
If nFactorHeight < 1
* AINDA NAO TESTADO, PODE HAVER ERROS !!!
If oWnd:ClassName() $ "/TLISTBOX/TCOMBOBOX/"
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight , ;
.F. )
Else
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight * nFactorHeight , ;
.F. )
EndIf
EndIf
If lRepaint
if oWnd:lCentered // *** AAA ***//
oWnd:Center() // *** AAA ***//
endif // *** AAA ***//
oWnd:Show()
EndIf
***************************************
* se for resolucao igual a que desenhou
***************************************
elseif lAutoresize .and. nOriHeight = nHeight
If nResolution > 0
nFactorWitdh := nWidth / nOriWidth
nFactorHeight := nHeight / nOriHeight
ElseIf nResolution < 0
nFactorWitdh := nOriWidth / nWidth
nFactorHeight := nOriHeight / nHeight
EndIf
If oWnd:ClassName()$"/TFOLDER/TPAGES/"
If ValType( oWnd:aDialogs ) = "A"
For nContador := 1 To Len( oWnd:aDialogs )
AutResiz( lAutoresize, nWhatSize, oWnd:aDialogs[nContador], nResolution, .F. )
EndFor
EndIf
elseif oWnd:ClassName()$"/TIMAGE/TBITMAP/TLISTBOX/TWBROWSE/TSSAY/TDSAY/TSAYREF/"
ad:=getcoors(ownd:hWnd)
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
((ad[4]-ad[2])) * nFactorWitdh, ;
((ad[3]-ad[1])) * nFactorHeight , ;
.F. )
oWnd:refresh()
elseif oWnd:ClassName()$"/TCOMBOBOX/TDBCOMBO/"
elseif oWnd:ClassName()$"/TXBROWSE/"
ElseIf oWnd:ClassName()$"/TIMAGE/"
Else
If ValType( oWnd:aControls ) = "A"
For nContador := 1 To Len( oWnd:aControls )
AutResiz( lAutoresize, nWhatSize, oWnd:aControls[nContador], nResolution, .F. )
* ajuste de fontes
* controle TSAY
if ownd:acontrols[nContador]:classname$"/TSAY/TSAYREF/"
ajustaalt(ownd:acontrols[nContador])
ajustalarg(ownd:acontrols[nContador],ownd)
ELSEif ownd:acontrols[nContador]:classname$"/TGET/TDSAY/TSSAY/"
ajustaalt(ownd:acontrols[nContador])
aj_get(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TFOLDER/TPAGES/TCOMBOBOX/TGROUP/TTREE/TCHECKBOX/TBTNBMP/TTOOLBAR/TRADIO/TDBCOMBO/TTABS/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TXBROWSE/"
aja_XBRW(ownd:acontrols[nContador],nFactorHeight)
ajl_XBRW(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TSBROWSE/"
aja_TSB(ownd:acontrols[nContador],nFactorHeight)
ajl_TSB(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TWBROWSE/"
aja_OLBX(ownd:acontrols[nContador],nFactorHeight)
ajl_OLBX(ownd:acontrols[nContador],nFactorWitdh)
endif
EndFor
EndIf
EndIf
EndIf
Return Nil
FUNCTION AjustaLarg(oq,ownd)
* se nao tiver fonte atribuida, nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F.,;
nAlturaDaFonte,;
nLarguraDaFonte := 0,;
nLarguraDoControle ,;
nTime := SECONDS()+3,;
oFontTmp,ofont
if cFontName="NAOFAZ"
return nil
endif
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDoControle := oq:nWidth
WHILE SECONDS() < nTime // Evita congelamento da aplicação caso não seja possível recalcular a fonte
nLarguraDaFonte += 1 // Nao funciona com numeros facionados
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE nLarguraDaFonte,ABS(nAlturaDaFonte)
lFlagReleaseFont := .T.
IF oWnd:GetWidth(oq:varget(),oFontTmp) >= nLarguraDoControle
EXIT
ENDIF
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
lFlagReleaseFont := .F.
ENDDO
IF lFlagReleaseFont
RELEASE FONT oFontTmp
ENDIF
oq:SetFont(oFont)
oq:Refresh()
RETURN NIL
FUNCTION AjustaAlt(oq)
* se nao tiver fonte , nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte:=0, nAlturaDoControle
LOCAL nLarguraDaFonte, nTime:= SECONDS()+3, oFontTmp,ofont
* se nao tiver fonte, volta sem ajustar
if cfontname="NAOFAZ"
return nil
endif
* se tiver fonte , ajusta
nAlturaDoControle := (oq:nHeight)-6
nLarguraDaFonte := oq:oFont:nWidth
WHILE SECONDS() < nTime // Evita congelamento da aplicação caso não seja possível recalcular a fonte
nAlturaDaFonte += 0.1 // Na altura o fracionamento funcionou
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE nLarguraDaFonte,nAlturaDaFonte
lFlagReleaseFont := .T.
IF oFontTmp:nHeight >= nAlturaDoControle
EXIT
ENDIF
oq:SetFont(oFontTmp)
oFont := oq:ofont //oSay:GetFont()
RELEASE FONT oFontTmp
lFlagReleaseFont := .F.
ENDDO
IF lFlagReleaseFont
RELEASE FONT oFontTmp
ENDIF
oq:SetFont(oFont)
oq:Refresh()
RETURN NIL
FUNCTION Aj_get(oq,nf)
* se nao tiver fonte , nao faz
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
Local lFlagReleaseFont := .F., nAlturaDaFonte ,;
nLarguraDaFonte := 0, nLarguraDoControle , nTime := SECONDS()+3,;
oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
FUNCTION ajl_FLD(oq,nf)
* se nao tiver fonte , nao faz
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte, nLarguraDaFonte := 0,;
nLarguraDoControle ,nTime:= SECONDS()+3, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
FUNCTION aja_FLD(oq,nf)
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nLarguraDaFonte := 0, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturaDaFonte:=nalturaDafonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
FUNCTION ajl_XBRW(oq,nf)
* se nao tiver fonte, nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte,;
nLarguraDaFonte := 0, nLarguraDoControle, nTime := SECONDS()+3,;
oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
for i=1 to len(oq:acols)
* redimensiona fontes do xbrw
oq:acols[i]:odatafont :=oFontTmp
oq:acols[i]:oHeaderFont:=ofontTmp
oq:acols[i]:oFooterFont:=oFontTmp
next
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
FUNCTION aja_XBRW(oq,nf)
* se nao tiver fonte, nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nLarguraDaFonte , oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturadaFonte:=nalturadafonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
* redimensiona as colunas do Xbrw
if nf=1
nf:=1.2
endif
for i=1 to len(oq:acols)
* pega tamanho anterior X factor
ov:=oq:aCols[i]:nWidth * nf
* atualiza o novo tamanho da coluna
oq:aCols[i]:nWidth := ov
next
oq:nStretchcol:=STRETCHCOL_LAST
oq:Refresh()
RETURN NIL
FUNCTION aja_OLBX(oq,nf)
* se nao tiver fonte, nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nLarguraDaFonte , oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturadaFonte:=nalturadafonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
* redimensiona as colunas do Xbrw
if nf=1
nf:=1.2
endif
oq:Refresh()
RETURN NIL
FUNCTION ajl_OLBX(oq,nf)
* se nao tiver fonte, nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte,;
nLarguraDaFonte := 0, nLarguraDoControle,;
nTime := SECONDS()+3, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
* atualiza a largura das colunas
for i=1 to len(oq:acolsizes)
oq:acolsizes[i]:=oq:acolsizes[i]*nf
next
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
FUNCTION Ajustal_ds(oq)
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nAlturaDoControle , nLarguraDaFonte , nTime := SECONDS()+3,;
oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturaDoControle := (oq:nHeight)-6
WHILE SECONDS() < nTime // Evita congelamento da aplicação caso não seja possível recalcular a fonte
nAlturaDaFonte += 0.1 // Na altura o fracionamento funcionou
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE nLarguraDaFonte,nAlturaDaFonte
lFlagReleaseFont := .T.
IF oFontTmp:nHeight >= nAlturaDoControle
EXIT
ENDIF
oq:SetFont(oFontTmp)
oFont := oq:ofont
RELEASE FONT oFontTmp
lFlagReleaseFont := .F.
ENDDO
IF lFlagReleaseFont
RELEASE FONT oFontTmp
ENDIF
oq:SetFont(oFont)
oq:Refresh()
RETURN NIL
* ajusta altura tsbrowse
FUNCTION aja_TSB(oq,nf)
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nLarguraDaFonte, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturadaFonte:=nalturadafonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
* redimensiona as colunas do Xbrw
if nf=1
nf:=1.2
endif
for i=1 to len(oq:acolumns)
* pega tamanho anterior X factor
ov:=oq:nHeightCell * nf
* atualiza o novo tamanho da coluna
oq:nHeightCell := ov
oq:nheightHead:=oq:nheightHead*nf
oq:nheightFoot:=oq:nheightFoot*nf
next
oq:Refresh()
RETURN NIL
* ajusta largura tsbrowse
FUNCTION ajl_TSB(oq,nf)
* se nao tiver fonte , nao faz !
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte ,;
nLarguraDaFonte := 0,;
nLarguraDoControle , nTime := SECONDS()+3, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
for i=1 to len(oq:acolumns)
* redimensiona fontes do tsbrowse
oq:acolumns[i]:oFont :=oFontTmp
oq:acolumns[i]:oFontHead:=ofontTmp
oq:acolumns[i]:oFontFoot:=oFontTmp
* reajusta a largura fo sbrowse
oq:acolsizes[i]:=oq:acolsizes[i]*nf
next
RELEASE FONT oFontTmp
oq:Refresh()
RETURN NIL
-
- Posts: 65
- Joined: Tue Apr 14, 2009 9:26 pm
- Location: Brasil
Re: APORTE: FUNCTION DISPLAY 2.0
Alfonso, estarei colocando essas mudanças en la nueva version de la funcion (3.0) que logo estarei a publicar.
Muchas gracias
William
Muchas gracias
William
Re: APORTE: FUNCTION DISPLAY 2.0
Hola
de donde lo puedo bajar?
Gracias
Saluditos
de donde lo puedo bajar?
Gracias
Saluditos
Que es mejor que programar? creo que nada
Atropellada pero aqui ando
I love Fivewin
séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Atropellada pero aqui ando
I love Fivewin
séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Re: APORTE: FUNCTION DISPLAY 2.0
Aida:
http://www.4shared.com/rar/NIwJho3C/DISPLAY3.html
Saludos
http://www.4shared.com/rar/NIwJho3C/DISPLAY3.html
Code: Select all
#include "FiveWin.ch"
#include "common.ch"
#include "xbrowse.ch"
*********************************************************************
* NOME......: DISPLAY(oWnd,nResolution)
*
* VERSAO....: 3.0 - Julho de 2010
*
* AUTOR.....: William de Brito Adami e FiveWidi, que iniciou este projeto
* no Forum Espanhol de Fivewin .
*
* DESCRICAO.: Funcao para exibir a tela sempre igual em qualquer
* resolucao, independente da fonte ou controle utilizado.
*
* PARAMETROS: oWnd: Window ou Dialog a ser redimensionado
* nResolution: Numero correspondente a resolucao
* que se desenhou inicialmente a tela.
*
*********************************************************************
function display( oWnd, nResolution, lFullres )
local lAutoresize:=.t. , nWhatSize:=0, lRepaint:=.t.
* atencao: nResolution identifica em que resolucao foram inicialmente
* desenhadas as telas, e DEVE ter um dos seguintes valores:
*
* 1 = 640 X 480
* 2 = 800 X 600
* 3 = 1024 X 768
* 4 = 1152 X 864
* 5 = 1280 X 800
* 6 = 1280 X 1024
* 7 = 1600 X 1200
* 8 = 768 X 1024
* 9 = 1440 X 900
* 10 = 1280 X 768
* 11 = 1280 X 720
* 12 = 1366 X 768
AutResiz( lAutoresize, nWhatSize, oWnd, nResolution, lRepaint, lFullres )
return nil
/*
(20/08/2009) Inicio do REdesenvolvimento da funcao.
Parametros recebidos :
lAutoresize: ativa / desativa redimensionamento automatico
nWhatSize: permite for‡ar o redimensionamento a valores concretos;
permitindo desta maneira que a aplica‡ao possa ter um valor
ao qual redimensionar as telas.
oWnd: Objeto/janela/dialogo/controle a ser redimensionado.
nResolution: Numero que identifica que resolucao tinha a tela na qual
se desenhou o objeto.
lRepaint: Indicador se deve repintar o objeto uma vez redimensionado.
lFullres: Indica se os textos devem ser redimensionados no tamanho maximo
do resource desenhado.
Esta funcao deve ser utilizada no evento ON INIT do ACTIVATE das WINDOWs
e DIALOGs .
Exemplo:
ACTIVATE DIALOG oDlg ON INIT display(oDlg,2,.t.) //desenhada em 800 X 600
-* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -*
*/
FUNCTION AutResiz( lAutoresize, nWhatSize, oWnd, nResolution, lRepaint,lFullres )
// Resolucao da tela no momento de definir os controles.
Local nOriWidth, nOriHeight
// o normal seria que fosse a resolucao atual da tela (nWhatSize=0).
// Se permite forcar esta resolucao mediante o valor de nWhatSize=1,2,3,4,5,6,7,....
Local nWidth, nHeight
// Sao as relacoes entre a resolucao de tela e a resolucao de desenho.
Local nFactorWitdh, nFactorHeight
Local nContador,ofonttmp
DEFAULT lRepaint := .T.
nOriWidth := 0
nOriHeight := 0
nWidth := 0
nHeight := 0
nContador := 0
If ABS(nResolution) = 1
nOriWidth := 640
nOriHeight := 480
ElseIf ABS(nResolution) = 2
nOriWidth := 800
nOriHeight := 600
ElseIf ABS(nResolution) = 3
nOriWidth := 1024
nOriHeight := 768
ElseIf ABS(nResolution) = 4
nOriWidth := 1152
nOriHeight := 864
ElseIf ABS(nResolution) = 5
nOriWidth := 1280
nOriHeight := 800
ElseIf ABS(nResolution) = 6
nOriWidth := 1280
nOriHeight := 1024
ElseIf ABS(nResolution) = 7
nOriWidth := 1600
nOriHeight := 1200
ElseIf ABS(nResolution) = 8
nOriWidth := 768
nOriHeight := 1024
ElseIf ABS(nResolution) = 9
nOriWidth := 1440
nOriHeight := 900
ElseIf ABS(nResolution) = 10
nOriWidth := 1280
nOriHeight := 768
ElseIf ABS(nResolution) = 11
nOriWidth := 1280
nOriHeight := 720
ElseIf ABS(nResolution) = 12
nOriWidth := 1366
nOriHeight := 768
Else
ScrResolution( @nOriWidth, @nOriHeight )
Endif
If nWhatSize = 1
nWidth := 640
nHeight := 480
ElseIf nWhatSize = 2
nWidth := 800
nHeight := 600
ElseIf nWhatSize = 3
nWidth := 1024
nHeight := 768
ElseIf nWhatSize = 4
nWidth := 1152
nHeight := 864
ElseIf nWhatSize = 5
nWidth := 1280
nHeight := 800
ElseIf nWhatSize = 6
nWidth := 1280
nHeight := 1024
ElseIf nWhatSize = 7
nWidth := 1600
nHeight := 1200
ElseIf nWhatSize = 8
nWidth := 768
nHeight := 1024
ElseIf nWhatSize = 9
nWidth := 1440
nHeight := 900
ElseIf nWhatSize = 10
nWidth := 1280
nHeight := 768
ElseIf nWhatSize = 11
nWidth := 1280
nHeight := 720
ElseIf nWhatSize = 12
nWidth := 1366
nHeight := 768
Else
ScrResolution( @nWidth, @nHeight )
Endif
If lAutoresize .and. nOriHeight != nHeight
/* Este sera o caso habitual, ao qual se pretende redimensionar
os controles na resolucao da tela na qual estao viendo. */
If nResolution > 0
nFactorWitdh := nWidth / nOriWidth
nFactorHeight := nHeight / nOriHeight
ElseIf nResolution < 0
nFactorWitdh := nOriWidth / nWidth
nFactorHeight := nOriHeight / nHeight
EndIf
If lRepaint
oWnd:Hide()
EndIf
* se aumentou a altura
If nFactorHeight > 1
*****************************
* se tiver barbutton * NOVO *
*****************************
if ownd:obar <> NIL
ownd:obar:nwidth:=ownd:obar:nwidth* nfactorwitdh
ownd:obar:nHeight:=ownd:obar:nHeight*nfactorheight
ownd:obar:nbtnwidth:=ownd:obar:nbtnwidth*nfactorwitdh
ownd:obar:nbtnHeight:=ownd:obar:nbtnHeight*nfactorheight
for i= 1 to len(ownd:obar:acontrols)
ownd:obar:acontrols[i]:Move( ownd:obar:acontrols[i]:nTop * nFactorHeight , ;
ownd:obar:acontrols[i]:nLeft * nFactorWitdh, ;
ownd:obar:acontrols[i]:nWidth * nFactorWitdh, ;
ownd:obar:acontrols[i]:nHeight * nFactorHeight , ;
.F. )
* redimensiona o BMP da BARBUTTON
o:=ownd:obar:acontrols[i]:hbitmap1
if o<>0
hbmp:=ownd:obar:acontrols[i]:hbitmap1
nbmpwidth := nbmpwidth(hbmp)
nbmpheight:= nbmpheight(hbmp)
larg:=nbmpwidth*nfactorwitdh
alt:=nbmpheight*nfactorheight
o:=resizebmp(o,larg ,alt )
ownd:obar:acontrols[i]:hbitmap1:=o
endif
next
ownd:obar:refresh()
endif
If oWnd:ClassName()$"/TIMAGE/"
ad:=getcoors(ownd:hWnd)
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
((ad[4]-ad[2])) * nFactorWitdh, ;
((ad[3]-ad[1])) * nFactorHeight , ;
.F. )
Else
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight * nFactorHeight , ;
.F. )
EndIf
EndIf
if oWnd:ClassName()$"/TFOLDER/TPAGES/"
If ValType( oWnd:aDialogs ) = "A"
For nContador := 1 To Len( oWnd:aDialogs )
AutResiz( lAutoresize, nWhatSize, oWnd:aDialogs[nContador], nResolution, .F.,lFullres )
EndFor
EndIf
Elseif oWnd:ClassName()$"/TBTNBMP/"
*********************************
* redimensiona o BMP do BTNBMP
o:=oWnd:hbitmap1
if o<>0
hbmp:=ownd:hbitmap1
nbmpwidth := nbmpwidth(hbmp)
nbmpheight:= nbmpheight(hbmp)
larg:=nbmpwidth*nfactorwitdh
alt:=nbmpheight*nfactorheight
o:=resizebmp(o,larg ,alt )
oWnd:hbitmap1:=o
endif
*********************************
elseif oWnd:ClassName()$"/TCOMBOBOX/TDBCOMBO/"
Else
If ValType( oWnd:aControls ) = "A"
For nContador := 1 To Len( oWnd:aControls )
AutResiz( lAutoresize, nWhatSize, oWnd:aControls[nContador], nResolution, .F.,lFullres )
* ajuste de fontess
* controle TSAY
if ownd:acontrols[nContador]:classname$"/TSAY/TSAYREF/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TGET/TSSAY/TDSAY/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TFOLDER/TPAGES/TCOMBOBOX/TGROUP/TTREE/TCHECKBOX/TBTNBMP/TTOOLBAR/TRADIO/TDBCOMBO/TTABS/TXBROWSE/TSBROWSE/TWBROWSE/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
endif
EndFor
EndIf
EndIf
* se diminuiu a altura
If nFactorHeight < 1
*****************************
* se tiver barbutton * NOVO *
*****************************
if ownd:obar <> NIL
ownd:obar:nwidth:=ownd:obar:nwidth* nfactorwitdh
ownd:obar:nHeight:=ownd:obar:nHeight*nfactorheight
ownd:obar:nbtnwidth:=ownd:obar:nbtnwidth*nfactorwitdh
ownd:obar:nbtnHeight:=ownd:obar:nbtnHeight*nfactorheight
for i= 1 to len(ownd:obar:acontrols)
ownd:obar:acontrols[i]:Move( ownd:obar:acontrols[i]:nTop * nFactorHeight , ;
ownd:obar:acontrols[i]:nLeft * nFactorWitdh, ;
ownd:obar:acontrols[i]:nWidth * nFactorWitdh, ;
ownd:obar:acontrols[i]:nHeight * nFactorHeight , ;
.F. )
* redimensiona o BMP da BARBUTTON
o:=ownd:obar:acontrols[i]:hbitmap1
if o<>0
hbmp:=ownd:obar:acontrols[i]:hbitmap1
nbmpwidth := nbmpwidth(hbmp)
nbmpheight:= nbmpheight(hbmp)
larg:=nbmpwidth*nfactorwitdh
alt:=nbmpheight*nfactorheight
o:=resizebmp(o,larg ,alt )
ownd:obar:acontrols[i]:hbitmap1:=o
endif
next
ownd:obar:refresh()
endif
***************************************
if oWnd:ClassName()$"/TIMAGE/"
ad:=getcoors(ownd:hWnd)
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
((ad[4]-ad[2])) * nFactorWitdh, ;
((ad[3]-ad[1])) * nFactorHeight , ;
.F. )
Elseif oWnd:ClassName()$"/TBTNBMP/"
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight * nFactorHeight , ;
.F. )
*********************************
* redimensiona o BMP do BTNBMP
o:=oWnd:hbitmap1
if o<>0
hbmp:=ownd:hbitmap1
nbmpwidth := nbmpwidth(hbmp)
nbmpheight:= nbmpheight(hbmp)
larg:=nbmpwidth*nfactorwitdh
alt:=nbmpheight*nfactorheight
o:=resizebmp(o,larg ,alt )
oWnd:hbitmap1:=o
endif
*********************************
Else
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
oWnd:nWidth * nFactorWitdh, ;
oWnd:nHeight * nFactorHeight , ;
.F. )
endif
If ValType( oWnd:aControls ) <> "A"
* ajuste de fontess
* controle TSAY
if ownd:classname$"/TSAY/TSAYREF/"
aja_FLD(ownd,nFactorHeight)
ajl_FLD(ownd,nFactorWitdh)
ELSEif ownd:classname$"/TGET/TSSAY/TDSAY/"
aja_FLD(ownd,nFactorHeight)
ajl_FLD(ownd,nFactorWitdh)
ELSEif ownd:classname$"/TFOLDER/TPAGES/TCOMBOBOX/TGROUP/TTREE/TCHECKBOX/TBTNBMP/TTOOLBAR/TRADIO/TDBCOMBO/TTABS/TXBROWSE/TSBROWSE/TWBROWSE/"
aja_FLD(ownd,nFactorHeight)
ajl_FLD(ownd,nFactorWitdh)
endif
EndIf
EndIf
If lRepaint
if oWnd:lCentered // *** AAA ***//
oWnd:Center() // *** AAA ***//
endif // *** AAA ***//
oWnd:Show()
EndIf
***************************************
* se for resolucao igual a que desenhou
***************************************
elseif lAutoresize .and. nOriHeight = nHeight
if lfullres
If nResolution > 0
nFactorWitdh := nWidth / nOriWidth
nFactorHeight := nHeight / nOriHeight
ElseIf nResolution < 0
nFactorWitdh := nOriWidth / nWidth
nFactorHeight := nOriHeight / nHeight
EndIf
If oWnd:ClassName()$"/TFOLDER/TPAGES/"
If ValType( oWnd:aDialogs ) = "A"
For nContador := 1 To Len( oWnd:aDialogs )
AutResiz( lAutoresize, nWhatSize, oWnd:aDialogs[nContador], nResolution, .F.,lfullres )
EndFor
EndIf
elseif oWnd:ClassName()$"/TIMAGE/" //TBITMAP/TLISTBOX/TWBROWSE/TSSAY/TDSAY/TSAYREF/"
ad:=getcoors(ownd:hWnd)
oWnd:Move( oWnd:nTop * nFactorHeight , ;
oWnd:nLeft * nFactorWitdh, ;
((ad[4]-ad[2])) * nFactorWitdh, ;
((ad[3]-ad[1])) * nFactorHeight , ;
.F. )
elseif oWnd:ClassName()$"/TCOMBOBOX/TDBCOMBO/"
Else
If ValType( oWnd:aControls ) = "A"
For nContador := 1 To Len( oWnd:aControls )
AutResiz( lAutoresize, nWhatSize, oWnd:aControls[nContador], nResolution, .F.,lfullres )
/*
* ajuste de fontes
* controle TSAY
if ownd:acontrols[nContador]:classname$"/TSAY/TSAYREF/"
* ajustaalt(ownd:acontrols[nContador],nfactorheight,lFullres)
* ajustalarg(ownd:acontrols[nContador],ownd,nfactorwitdh,lFullres)
ELSEif ownd:acontrols[nContador]:classname$"/TGET/TSSAY/TDSAY/"
* ajustaalt(ownd:acontrols[nContador],nfactorheight,lFullres)
* ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
ELSEif ownd:acontrols[nContador]:classname$"/TFOLDER/TPAGES/TCOMBOBOX/TGROUP/TTREE/TCHECKBOX/TBTNBMP/TTOOLBAR/TRADIO/TDBCOMBO/TTABS/TXBROWSE/TSBROWSE/TWBROWSE/"
aja_FLD(ownd:acontrols[nContador],nFactorHeight)
ajl_FLD(ownd:acontrols[nContador],nFactorWitdh)
endif
*/
EndFor
EndIf
EndIf
endif
EndIf
Return Nil
FUNCTION ajl_FLD(oq,nf)
* se nao tiver fonte , nao faz
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte, nLarguraDaFonte := 0,;
nLarguraDoControle ,nTime:= SECONDS()+3, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDoControle := oq:nWidth
nAlturaDaFonte := oq:oFont:nHeight
nLarguraDaFonte = nLarguraDaFonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
If oq:ClassName()$"/TXBROWSE/"
for i=1 to len(oq:acols)
* pega tamanho anterior X factor
ov:=oq:aCols[i]:nWidth * nf
* atualiza o novo tamanho da coluna
oq:aCols[i]:nWidth := ov
next
elseif oq:classname$"/TDSAY/"
oq:Refresh()
elseif oq:ClassName()$"/TWBROWSE/"
* atualiza a largura das colunas
for i=1 to len(oq:acolsizes)
oq:acolsizes[i]:=oq:acolsizes[i]*nf
next
endif
* oq:Refresh()
RETURN NIL
FUNCTION aja_FLD(oq,nf)
LOCAL cFontName := iif ( oq:oFont=NIL , "NAOFAZ" ,oq:oFont:cFaceName )
LOCAL lFlagReleaseFont := .F., nAlturaDaFonte := 0,;
nLarguraDaFonte, oFontTmp,ofont
if cfontname="NAOFAZ"
return nil
endif
if oq:oFont:nWidth = NIL // *** AAA ***//
oq:oFont:nWidth := 0 // *** AAA ***//
endif // *** AAA ***//
nLarguraDaFonte := oq:oFont:nWidth
nAlturadaFonte:=nalturadafonte*nf
DEFINE FONT oFontTmp;
NAME cFontName;
SIZE abs(nLarguraDaFonte),ABS(nAlturaDaFonte)
oq:SetFont(oFontTmp)
oFont := oq:ofont //osay:GetFont()
RELEASE FONT oFontTmp
If oq:ClassName()$"/TXBROWSE/"
oq:nRowHeight := oq:nRowHeight* nf
oq:nStretchcol:=STRETCHCOL_LAST
elseif oq:ClassName()$"/TSBROWSE/"
oq:nHeightCell:=oq:nHeightCell * nf
* oq:nheightHead:=oq:nheightHead*nf
* oq:nheightFoot:=oq:nheightFoot*nf
endif
* oq:Refresh()
RETURN NIL
João Santos - São Paulo - Brasil
Re: APORTE: FUNCTION DISPLAY 2.0
Karinha
Muchas gracias
Saluditos
Muchas gracias
Saluditos
Que es mejor que programar? creo que nada
Atropellada pero aqui ando
I love Fivewin
séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Atropellada pero aqui ando
I love Fivewin
séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ