Como se convierte font de Twindows a FONT DE TPRINTER

Como se convierte font de Twindows a FONT DE TPRINTER

Postby Vladimir Zorrilla » Tue Apr 18, 2006 6:40 pm

Amigos


Trato de pulir un diseñador visual en tiempo de ejecucion como hago para convertir los fonts de gets q tengo en un TWINDOWS a FONTS de
la clase TPRINTER la idea es q se imprima lo q se tiene en la
TWINDOWS que simula al papel en la respectiva proporcion en
la vista previa con la clase tPRINTER

ADJUNTO EL CODIGO A QUIEN ESTUVIERA INTERESADO

#include 'fivewin.ch'
#include 'filexls.ch'

#define TAB chr(9)
#define ENTER chr(13)

#define ALI_LEFT 0
#define ALI_CENTER 1
#define ALI_RIGHT 2
#define ALI_JUSTIFY 3

#define LOGPIXELSX 88
#define LOGPIXELSY 90

// Registros y delimitadores de campos de la estructura GTF
#define SP_REG Chr( 5 )
#define SP_FIELD Chr( 7 )
#define TP_FONT Chr( 15 )
#define TP_COLOR Chr( 16 )
#define TP_ALIGN Chr( 17 )

// Identificador y versión de las ficheros GTF
#define FORMAT_TEXT_TYPE "GTF"
#define FORMAT_TEXT_VERSION "1"

// todo lo anterior son define de LA CLASE TWORD

#define FW_NORMAL 400
#define FW_BOLD 700

Static oWndr,hayGroup,aSelGroup,oGroup,laclase,letrapixel
Static oReglav,oReglah,arrto,arrbusto,aAdic,NOaltfila
Static lBoxDraw,nBoxTop,nBoxLeft,nBoxBottom,nBoxRight,aSelCtrls,anClrpane
Static _fila,_colu,TRACE,expanterior
//// 24/08/2004 - METODO PARA GRABAR UNA LINEA POR CONTROL COMPATIBLE CON ANTERIOR
//// -
////
/// 20/01/2004
////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/// VISUAL REPORT DESIGNER EN RUN TIME
//// TIEMPO DE EJECUCION
///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
// 1 2 3 4 5 6 7
FUNC VZLABEL(fmtos,TITI,bmp,Funcparam,Dblclick,posi,ntimp,arrayAdic,lnoaltefila,cValid)//posicion de inicio de repeticon de expresion por todo el cursor
//Testing how to scroll a window with its contents//ntimp = 1 que se imprima directo
LOCAL oScrWnd,obmpfon,aGets:={},oScroll
if empty(lnoaltefila);NOaltfila:=.F.
else ;NOaltfila:=.T.
endif
lBoxDraw:=.f.
aAdic:=arrayAdic
//?" QUE VALE aAdic ",aAdic,valtype(aAdic)
//?"decuelta a 29"
letrapixel:=GetTextWidth( 0,"|" )
IF EMPTY(bmp);bmp:="";END
DEFINE CURSOR oCursor HAND
hayGroup:=.f.
aSelGroup:={}
if empty(titi);TITI:="Visual Report Designer";end
if file(rclipper()+"BITMAP\"+BMP+".BMP")
DEFINE BITMAP obmpfon FILE rclipper()+"BITMAP\"+BMP+".BMP"
ENDIF
setgridsize(1,1)
//drawgrid(10)
if empty(ntimp)
define window oWndr from 0, 0 TO 25, 70 title TITI vscroll hscroll
else
define window oWndr from -1,-1 TO -2, -2 title TITI vscroll hscroll
endif
if file(rclipper()+"BITMAP\"+BMP+".BMP")
oWndr:bpainted = { || oWndr:SayBitmap(0,0,obmpfon) }
ENDIF


oWndr:bLButtonUp = { | nRow, nCol, nFlags | MyrLButtonUp( nRow, nCol, nFlags,oWndr ) }
oWndr:bMButtonDown = { | nRow, nCol, nFlags | myrLButtonDown( nRow, nCol, nFlags,oWndr ) }
oWndr:bMMoved = { | nRow, nCol, nFlags | myrMouseMove( nRow, nCol, nFlags,oWndr ) }


//oWndr:bMMoved = { | nRow, nCol, nFlags | oWndr:SetText( "Fila="+ltrim(str( nRow ))+" Colu="+ltrim(str( nCol ))+" " ) }

oWndr:bRClicked = { | nRow, nCol, nFlags | ShowPopupVR( nRow, nCol, oWndr,aGets ) }

oWndr:bLDblClick = { | nRow, nCol, nFlags | GraoWnd(oWndr,fmtos,oScroll) }
//oWndr:bRButtonUp = { | nRow, nCol, nFlags | adigrupo( nRow, nCol ) }
//oWndr:bLDblClick = { | nRow, nCol, nFlags | oWndr:cGenPRG( "C:\Code.prg" ),WAITRUN("NOTEPAD C:\Code.prg") }

//?"cuanto vale ntimp",ntimp

oWndr:bLclicked:= {| nRow, nCol, nFlags | danrClrpane() , MyrLButtonDown( nRow, nCol, nFlags,oWndr ) }
oWndr:bGotFocus:= { || lBoxDraw:=.f., danrClrpane() }
If !empty(cValid)
oWndr:bValid:= &(" { || "+cValid+" } ")
Endif
if empty(ntimp)
ACTIVATE WINDOW oWndr ;
ON INIT ( oScroll:=VZTScrWnd():New(oWndr,1,40,1,25) , CargaoWnd(oWndr,fmtos,@aGets,Dblclick) ,ToolR(aGets,Funcparam,TITI,oScroll,Dblclick,posi),oWndr:Maximize(),reglas(oWndr) )
else
ACTIVATE WINDOW oWndr ;
ON INIT ( oScroll:=VZTScrWnd():New(oWndr,1,40,1,25) , CargaoWnd(oWndr,fmtos,@aGets,Dblclick) ,oWndr:Hide(),implabel(oWndr,Funcparam,TITI,oScroll,posi,ntimp),oWndr:End() )
endif
//obmpfon:END()
RETURN( NIL )


Func reglas(oWndr)
LOCAL oFont,oPen
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -8
DEFINE PEN oPen WIDTH 0.1

oReglah := TRegla():New( oWndr, 0,0,oWndr:nWidth, 30, .t.,0, 100, ;
.t., oFont ,oPen , .t.,CLR_BLACK, 12171705 ,3.5,3.5 )

oReglav := TRegla():New( oWndr, 0,660, 1300 , 6000 , .t.,0, 500, ;
.f., oFont ,oPen , .t.,CLR_BLACK, 12171705 ,3.5,3.5 )
//oReglah:Hide()//;oReglav:Hide()
oPen:End();oFont:End()
retu .t.

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

function ShowPopupVR( nRow, nCol , oWnd ,aGets)
local oMenu
MENU oMenu POPUP
MENUITEM "Cambiar fuente " ACTION cambiafuente(oWnd)
MENUITEM "Cambiar Color " ACTION cambiacolor(oWnd)
MENUITEM "Texto a la izquierda " ACTION cambiaalin(oWnd,0)
MENUITEM "Texto a la Derecha" ACTION cambiaalin(oWnd,1)
MENUITEM "Texto al Centro " ACTION cambiaalin(oWnd,2)
MENUITEM "Multiplicar Vertical" ACTION multipctrl(oWnd,aGets,"V")
MENUITEM "Multiplicar Horizontal" ACTION multipctrl(oWnd,aGets,"H")

MENUITEM "Ver Datos " ACTION EditaoWnd(oWnd)
MENUITEM "Eliminar Texto " ACTION eliminactrl(oWnd)
SEPARATOR
MENUITEM "Texto Normal" ACTION pontooltip(oWnd,"Texto Normal")
MENUITEM "Expresion xbase " ACTION pontooltip(oWnd,"Expresion xbase")
MENUITEM "Parametro de Funcion" ACTION pontooltip(oWnd,"Parametro de Funcion")
MENUITEM "Expresion xbase cabecera" ACTION pontooltip(oWnd,"Expresion xbase cabecera")
MENUITEM "xbase a repetirse en todo el cursor" ACTION pontooltip(oWnd,"xbase a repetirse en todo el cursor")
MENUITEM "Expresion xbase pies" ACTION pontooltip(oWnd,"Expresion xbase pies")
MENUITEM "xbase a repetirse en todo el array" ACTION pontooltip(oWnd,"xbase a repetirse en todo el array")
MENUITEM "xbase con SANGRIA a 60 caracteres" ACTION pontooltip(oWnd,"SANGRIA 60")
MENUITEM "Cambiar fuente a todo " ACTION todocambiafuente(oWnd)
ENDMENU
ACTIVATE POPUP oMenu OF oWnd AT nRow, nCol
return nil

FUNC CargaoWnd(oWnd,fmtos,aGets,Dblclick)
Local cmd,j6:=1,n,acos,j:=1,control,aRect,oGets,letras,MCRUT
Local cFont,ofont,aFont,lRight:=.f.,lCenter:=.f.,njustyf
Local cTYpe:=Upper("GBOX"),nBottom :=100,nRight :=100,nClrLite:= 0,nClrDark:= 0


IF EMPTY(FMTOS);fmtos:="PRUEBA";ENDIF
IF FILE(rclipper()+"fmtos\"+FMTOS+".fmt")
cmd:=memoread(rclipper()+"fmtos\"+FMTOS+".fmt")
IF (n:=AT(CHR(13),cmd))>0 ;cmd:=SUBS(cmd,1,n-1);ENDIF
IF (n:=AT(CHR(10),cmd))>0 ;cmd:=SUBS(cmd,1,n-1);ENDIF
cmd:=alltrim(cmd);acos:=llenarray(cmd,0,"|")
aGets:=Array(len(acos)/9) ;oGets:=Array(len(acos)/9)
//msgalert(len(acos),"acos")
//msgalert(len(agets),"aget")
while j6<=len(acos)
//?letrapixel,acos[j6+2]

IF alltrim(acos[j6+4])="__BOX__"
aGets[j]:=" "
// oGrp :=TGroup():New( nRow , nCol , nRow+100 , nCol+100 , cCaption, oForm, nClrText, nClrPane, .T. ,lDesign , oFont, .t. )
//oGets[j]:= TGroup():New( val(acos[j6]),val(acos[j6+1]),val(acos[j6])+val(acos[j6+3]),val(acos[j6+1])+val(acos[j6+2]) , "" , oWndr, , , .T. , .T. , NIL , .t. )
// oLin:=TSLines():New( nRow , nCol , nBottom , nRight , cType, oForm, nClrLite, nClrDark, nClrText, .t. , .F. , .t. , , oFont, , lDesign )
//?val(acos[j6]),val(acos[j6+1]),val(acos[j6+3]), val(acos[j6+2])
oGets[j]:=TSLines():New( val(acos[j6]),val(acos[j6+1]),val(acos[j6])+val(acos[j6+2]), val(acos[j6+1])+val(acos[j6+3]), cType, oWndr, nClrLite, nClrDark, 0 , .t. , .F. , .t. , , , , .t. )
//oGets[j]:=TSLines():New( val(acos[j6]),val(acos[j6+1]),val(acos[j6])+val(acos[j6+3]), val(acos[j6+1])+val(acos[j6+2]), cType, oWndr, nClrLite, nClrDark, 0 , .t. , .F. , .t. , , , , .t. )
oGets[j]:SetSize(val(acos[j6+2]),val(acos[j6+3]) )
oGets[j]:CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma"
oGets[j]:cTooltip:="__BOX__"
oGets[j]:NIDFOLDER:=0 // alinead a la izq
oGets[j]:NPAGINA:=0 // color negro
oGets[j]:lRounded:=.F.
oGets[j]:Refresh()
ELSE
letras:=int(val(acos[j6+2])/letrapixel)
// depende de la justificacion
njustyf:= val(acos[j6+8])
Do case
case njustyf=0 // Izquierda
aGets[j] :=acos[j6+5]+space(letras-len(acos[j6+5]) )
lCenter:=.f. ;lRight:=.f.
case njustyf=1 // Derecha
aGets[j] :=space(letras-len(acos[j6+5]) )+acos[j6+5]
lCenter:=.f. ;lRight:=.t.
case njustyf=2 // Centro
aGets[j] :=acos[j6+5]+space(letras-len(acos[j6+5]) )
lCenter:=.t. ;lRight:=.f.
Endcase
// njustyf:=0 // no nos engañemos el align del cmsay no se que hace justif izq y transform
// TGet():New( nRow , nCol , bSETGET(<uVar>) , oWnd, nWidth , nHeight , cPict , {ValidFunc}, nClrFore, nClrBack,oFont, .design., oCursor, .pixel., cMsg, .update., {uWhen},.lCenter., .lRight.,{|nKey, nFlags, Self| <uChange>\}, .readonly., .pass., .lNoBorder., nHelpId )
oGets[j] := TGet():New( val(acos[j6]), val(acos[j6+1]), GynLocalBlock( aGets, j ) ,oWndr, val(acos[j6+2]), val(acos[j6+3]), , , , , , .T. , , .T. , , .T. , , lCenter , lRight , , .F. , .F. , .t. , , .F.,,,, )
//oGets[j]:bResized:={ || oGet[:Varput( oget
oGets[j]:npagina := val(acos[j6+8])
oGets[j]:cToolTip:= alltrim(acos[j6+4])
oGets[j]:caFonts := acos[j6+6]
oGets[j]:nidFolder:= val(acos[j6+7])
// ?j,oGets[j]:cToolTip
if !empty(oGets[j]:nidFolder)
oGets[j]:SetColor( val(oGets[j]:nidFolder), 16777215 )
oGets[j]:Refresh()
endif
//oGets[j]:nStyle := nOR( WS_CHILD, WS_VISIBLE, ES_AUTOHSCROLL , NOT_WS_BORDER , WS_TABSTOP, WS_CLIPSIBLINGS )
// Preparado para la ultima alienamiento
//control:bGotFocus:=&("{ || alignDEL( "+chr(34)+cnomoDlg+"_"+ltrim(str(control:nId))+chr(34)+") }" )
cFont:=oGets[j]:caFonts
aFont:=llenarray(cFont,0)
if !EMPTY(cFont); aFont:=llenarray(cFont,0)
IF LEN(aFont)>=14
//ALERT( , aFont ,)
//? "1",aFont[ LF_FACENAME ],"2",aFont[ LF_HEIGHT ],"3",aFont[ LF_WEIGHT ],"4",aFont[ LF_ESCAPEMENT ],"5",aFont[ LF_ORIENTATION ],"6",aFont[ LF_WEIGHT ],"7",aFont[ LF_ITALIC ],"8",aFont[ LF_UNDERLINE ],"9",aFont[ LF_STRIKEOUT ],"10",aFont[ LF_CHARSET ],"11",aFont[ LF_OUTPRECISION ],"12",aFont[ LF_CLIPPRECISION ],"13",aFont[ LF_QUALITY ],"14",aFont[ LF_PITCHANDFAMILY ]
oFont = TFont():New( aFont[ 14 ],val(aFont[ 2 ]), val(aFont[ 1 ]), .f.,;
! ( val(aFont[ 5 ]) == FW_NORMAL ),;
val(aFont[ 3 ]), VAL(aFont[ 4 ]),;
val(aFont[ 5 ]), IF(aFont[ 6 ]="T",.T.,.F.),;
IF(aFont[ 7 ]="T",.T.,.F.), IF(aFont[ 8 ]="T",.T.,.F.),;
val(aFont[ 9 ]), val(aFont[ 10 ]),;
val(aFont[ 11 ]), val(aFont[ 12 ]),,;
val(aFont[ 13 ]) )
oGets[j]:SetFont( oFont )
oGets[j]:Refresh()
oFont:End()
ENDIF
endif
if !empty(Dblclick) .AND. oGets[j]:cToolTip="Parametro de Funcion"// hay funcion para prog dobleclick
mcrut:="{ || "+Dblclick+"("+chr(34)+acos[j6+5]+chr(34)+") }"
if vcerror(mcrut)
oGets[j]:blDblclick:=&mcrut
endif
endif
ENDIF
//////////////////////
j++
j6+=9
Enddo
ENDIF
RETU .T.

Func ToolR(aGets,Funcparam,TITI,oScroll,Dblclick,posi)
Local oDlgT,oBtn_1,oBtn_2,oBtn_3,oBtn_4,oBtn_5,oBtn_6,oBtn_7,oBtn_8,oBtn21,oBtn22,oBtn15,oBtn16,oBtn17,oBtn18
local oBtn115,oBtn116,oBtn117,oBtn118

// mostrarr el tools

DEFINE DIALOG oDlgT SIZE 50,295 TITLE "Tools"

@ 0, 0 BTNBMP oBtn_1 NAME "FLECHA" NOBORDER SIZE 11, 11 ACTION ( llenalDrag(.t.,oWndr),oWndr:Refresh() ) OF oDlgT ;oBtn_1:cTOOLTIP:= "Tiempo de Diseño "
@ 0, 15 BTNBMP oBtn_2 NAME "ALTO" NOBORDER SIZE 11, 11 ACTION ( LlenalDrag(.f.,oWndr),oWndr:Refresh() ) OF oDlgT ;oBtn_2:cTOOLTIP:= "Tiempo Ejecucion "

@ 0+12,0 BTNBMP oBtn_3 NAME "grilla" NOBORDER SIZE 11, 11 ACTION ponergrilla(oWndr) OF oDlgT ;oBtn_3:cTOOLTIP:= "Poner Grilla"
@ 0+12,15 BTNBMP oBtn_4 NAME "nogrilla" NOBORDER SIZE 11, 11 ACTION quitargrilla(oWndr) OF oDlgT ;oBtn_4:cTOOLTIP:= "Quitar Grilla"


@ 0+12+12, 0 BTNBMP oBtn_5 NAME "reglah" NOBORDER SIZE 11, 11 ACTION if(oReglah:lVisible,oReglah:Hide(),oReglah:Show()) OF oDlgT ;oBtn_5:cTOOLTIP:= "Regla Horizontal "
@ 0+12+12, 15 BTNBMP oBtn_6 NAME "reglav" NOBORDER SIZE 11, 11 ACTION if(oReglav:lVisible,oReglav:Hide(),oReglav:Show()) OF oDlgT ;oBtn_6:cTOOLTIP:= "Regla Vertical "
/*
@ 0+12+12 , 0 BTNBMP oBtn_5 NAME "IZQUIERDA" NOBORDER SIZE 11, 11 ACTION cambiaalin(oWndr,0) OF oDlgT ;oBtn_5:cTOOLTIP:= "Texto a la izquierda "
@ 0+12+12 ,15 BTNBMP oBtn_6 NAME "DERECHA" NOBORDER SIZE 11, 11 ACTION cambiaalin(oWndr,1) OF oDlgT ;oBtn_6:cTOOLTIP:= "Texto a la Derecha"
*/
@ 12+12+12, 0 BTNBMP oBtn_7 NAME "WORD" NOBORDER SIZE 11, 11 ACTION imp2word(oWndr,Funcparam,TITI,oScroll,posi) OF oDlgT ;oBtn_7:cTOOLTIP:= "Importar a Word"
@ 12+12+12,15 BTNBMP oBtn_8 NAME "EXCEL" NOBORDER SIZE 11, 11 ACTION imp2excel(oWndr,Funcparam,TITI,oScroll,posi) OF oDlgT ;oBtn_8:cTOOLTIP:= "Importar a Excel"


@ 0+12+12+24 , 0 BTNBMP oBtn1 NAME "impo" NOBORDER SIZE 11, 11 ACTION implabel(oWndr,Funcparam,TITI,oScroll,posi) OF oDlgT ;oBtn1:cTOOLTIP:= "Impresion Directa " //),condicion,evacondi
@ 0+12+12+24 ,15 BTNBMP oBtn2 NAME "SETUP" NOBORDER SIZE 11, 11 ACTION PRINTERSETUP() OF oDlgT ;oBtn2:cTOOLTIP:= "Configuración de Impresion "

@ 12+12+12+24, 0 BTNBMP oBtn3 NAME "GET" NOBORDER SIZE 11, 11 OF oDlgT ;oBtn3:cTOOLTIP:= "Jalar una expresion " ;oBtn3:oDragCursor = oCursor
@ 12+12+12+24,15 BTNBMP oBtn4 NAME "grOup" NOBORDER SIZE 11, 11 OF oDlgT ;oBtn4:cTOOLTIP:= "Jalar una Caja (Box)" ;oBtn4:oDragCursor = oCursor
/*
@ 48+12+12+24 , 0 BTNBMP oBtn21 NAME "ALFIL" NOBORDER SIZE 11, 11 ACTION alinealo("F") OF oDlgT ;oBtn21:cTOOLTIP:= "Alinea Filas " // ;oBtn1:oDragCursor = oCursor
@ 48+12+12+24 , 15 BTNBMP oBtn22 NAME "ALCOL" NOBORDER SIZE 11, 11 ACTION alinealo("C") OF oDlgT ;oBtn22:cTOOLTIP:= "Alinea Columnas " // ;oBtn1:oDragCursor = oCursor
*/

@ 24+12+12+24 , 0 BTNBMP oBtn15 NAME "VZL1" NOBORDER SIZE 11, 11 ACTION vzrllalinea(1) OF oDlgT ;oBtn15:cTOOLTIP:= "Alinea arriba"
@ 24+12+12+24 , 15 BTNBMP oBtn16 NAME "VZL2" NOBORDER SIZE 11, 11 ACTION vzrllalinea(2) OF oDlgT ;oBtn16:cTOOLTIP:= "Alinea abajo "
@ 36+12+12+24 , 0 BTNBMP oBtn17 NAME "VZL3" NOBORDER SIZE 11, 11 ACTION vzrllalinea(3) OF oDlgT ;oBtn17:cTOOLTIP:= "Alinea Izquierda"
@ 36+12+12+24 , 15 BTNBMP oBtn18 NAME "VZL4" NOBORDER SIZE 11, 11 ACTION vzrllalinea(4) OF oDlgT ;oBtn18:cTOOLTIP:= "Alinea Derecha"
@ 48+12+12+24 , 0 BTNBMP oBtn21 NAME "VZL5" NOBORDER SIZE 11, 11 ACTION vzrllalinea(5) OF oDlgT ;oBtn21:cTOOLTIP:= "Uniformiza maximo ancho"
@ 48+12+12+24 , 15 BTNBMP oBtn22 NAME "VZL6" NOBORDER SIZE 11, 11 ACTION vzrllalinea(6) OF oDlgT ;oBtn22:cTOOLTIP:= "Uniformiza maximo alto"


@ 24+12+12+24+12+24 , 0 BTNBMP oBtn115 NAME "ARR" NOBORDER SIZE 11, 11 ACTION muevelo("V",-1) OF oDlgT ;oBtn115:cTOOLTIP:= "Bloque arriba" // ;oBtn1:oDragCursor = oCursor
@ 24+12+12+24+12+24 , 15 BTNBMP oBtn116 NAME "ABJ" NOBORDER SIZE 11, 11 ACTION muevelo("V",1 ) OF oDlgT ;oBtn116:cTOOLTIP:= "Bloque abajo " // ;oBtn1:oDragCursor = oCursor
@ 36+12+12+24+12+24 , 0 BTNBMP oBtn117 NAME "IZQ" NOBORDER SIZE 11, 11 ACTION muevelo("H",-1) OF oDlgT ;oBtn117:cTOOLTIP:= "Bloque izquierda " // ;oBtn1:oDragCursor = oCursor
@ 36+12+12+24+12+24 , 15 BTNBMP oBtn118 NAME "DER" NOBORDER SIZE 11, 11 ACTION muevelo("H",1 ) OF oDlgT ;oBtn118:cTOOLTIP:= "Bloque derecha " // ;oBtn1:oDragCursor = oCursor


// @ 60 , 0 BTNBMP oBtn23 FILE "vclon\browse.bmp" NOBORDER SIZE 11, 11 ACTION camnalign(0) OF oDlgT ;oBtn23:cTOOLTIP:= "Jalar Campos de una Tabla " // ;oBtn1:oDragCursor = oCursor
// @ 60 , 15 BTNBMP oBtn24 FILE "vclon\CAMFO.bmp" NOBORDER SIZE 11, 11 ACTION (camnalign(0),vzcambfon()) OF oDlgT ;oBtn24:cTOOLTIP:= "Cambiar Fondo " // ;oBtn1:oDragCursor = oCursor

// @ 72 , 0 BTNBMP oBtn19 FILE "vclon\say.bmp" NOBORDER SIZE 11, 11 ACTION (camnalign(0),ponldrag(oDlg)) OF oDlgT ;oBtn19:cTOOLTIP:= "Traer controles de Tablas " // ;oBtn1:oDragCursor = oCursor
// @ 72 , 15 BTNBMP oBtn20 FILE "vclon\ELIM.bmp" NOBORDER SIZE 11, 11 ACTION (ponldrag(oDlg),camnalign(3)) OF oDlgT ;oBtn20:cTOOLTIP:= "Eliminar Control " // ;oBtn1:oDragCursor = oCursor


//oBtn2:bDragBegin = { || laclase := "DATA" } //msginfo("TBUTTON") } //
oBtn3:bDragBegin = { || laclase := "GET" } //msginfo("TGET") } //
oBtn4:bDragBegin = { || laclase := "GROUP" } //msginfo("TSSAY") } //

ACTIVATE DIALOG oDlgt NOWAIT
// oBar1:Float()
oWndr:bDropOver = { || AddGet(aGets,Dblclick) }

Func GraoWnd(oWnd,donde,oScroll)
Local j,control,aRect,coor:=""
//oScroll:HScrollTrack(0) ;oScroll:VScrollTrack(0)
// se baja una linea la porqueria esta
//For j=1 to len(oWnd:aControls) ;control:=oWnd:aControls[j]
// aRect:=GetCoors( Control:hWnd )
// oWnd:aControls[j]:Move( aRect[1]-(oWnd:aControls[j]:nHeight/4),aRect[2] )
//Next j
//oWnd:Refresh()
oScroll:HScrollPgUp();oScroll:HScrollPgUp();oScroll:HScrollPgUp();oScroll:HScrollPgUp()
oScroll:VScrollPgUp();oScroll:VScrollPgUp();oScroll:VScrollPgUp();oScroll:VScrollPgUp()
if empty(donde);donde:="prueba";end
oWnd:Gotop()
If hayGroup
oGroup:Hide();oGroup:End() ;hayGroup:=.f.;aSelgroup:={}
endif
// TODOS ESTOS DATOS NECESITO EN EL GET PARA TRASLADARLO AL CMSAY
// METHOD CmSay( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad );
For j=1 to len(oWnd:aControls); control:=oWnd:aControls[j]
aRect:=GetCoors( control:hWnd )
//msgalert(valtype( control:Varget() ) ,"tipo del varget")
//msgalert(valtype( control:ctooltip ) ,"tipo del ctooltip")
if valtype(control:ctooltip)="U" ;control:ctooltip:="";end
if valtype(control:caFonts)="U" ;control:caFonts:=SPACE(4);end
if valtype(control:nidfolder)="U";control:nidfolder:=space(3);end
if valtype(control:npagina)="U" ;control:npagina:=space(1);end

//?" QUE VALE control:caFonts",control:caFonts,VALTYPE(control:caFonts)
/*
?j,control:Varget(),"1",valtype(aRect[1]),;
"2",valtype(aRect[2]),;
"3nWidth ",valtype(control:nWidth) ,;
"4nHeight ",valtype(control:nHeight),;
"5cTooltip ",valtype(control:cTooltip),;
"6Varget ",valtype(control:Varget()),;
"7CAFONTS ",valtype(control:CAFONTS),;
"8NIDFOLDER ",valtype(control:NIDFOLDER),;
"9NPAGINA ",valtype(control:NPAGINA)
*/
if control:ClassName()="TGET"
if valtype(control:Varget())="U"//;control:VarPut(space(20));end
// 1 2 3 4 5 6 7 8 9
// nRow | nCol | nWidth | nHeight | SEGMENTO | cText | CAFONTS | nBkMode/NIDFOLDER | nPad/NPAGINA
//?"GRABANDO...",J,aRect[1],aRect[2],control:nWidth,control:nHeight ))+"|"+ control:cTooltip +"|"+alltrim( control:Varget() )+"|"+alltrim( control:CAFONTS )+"|"+control:NIDFOLDER+"|"+control:NPAGINA+"|"
/// coor+=ltrim(str(aRect[1]))+"|"+ltrim(str(aRect[2]))+"|"+ltrim(str( control:nWidth ))+"|"+ltrim(str( control:nHeight ))+"|"+ control:cTooltip +"|"+alltrim( control:Varget() )+"|"+alltrim( control:CAFONTS )+"|"+control:NIDFOLDER+"|"+control:NPAGINA+"|"
else
if empty(control:nWidth);control:nWidth:=0;end
if empty(control:nHeight);control:nHeight:=0;end
if empty(control:cTooltip);control:cTooltip:="Texto Normal";end
if empty(control:CAFONTS);control:CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";END
if empty(control:NIDFOLDER);control:NIDFOLDER:=0;END
if empty(control:NPAGINA);control:NPAGINA:=0;END
if valtype(control:NPAGINA)="C";control:NPAGINA:=val(control:NPAGINA);end
coor+=ltrim(str(aRect[1]))+"|"+ltrim(str(aRect[2]))+"|"+ltrim(str( control:nWidth ))+"|"+ltrim(str( control:nHeight ))+"|"+ control:cTooltip +"|"+alltrim( control:Varget() )+"|"+alltrim( control:CAFONTS )+"|"+ltrim(str(control:NIDFOLDER))+"|"+ltrim(str(control:NPAGINA))+"|"
endif
elseif control:ClassName()="TSLINES"
//?control:nWidth,control:nHeight
if empty(control:nWidth);control:nWidth:=0;end
if empty(control:nHeight);control:nHeight:=0;end
if empty(control:cTooltip);control:cTooltip:="__BOX__";end
if empty(control:CAFONTS);control:CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";END
if empty(control:NIDFOLDER);control:NIDFOLDER:=0;END
if empty(control:NPAGINA);control:NPAGINA:=0;END
if valtype(control:NPAGINA)="C";control:NPAGINA:=val(control:NPAGINA);end
coor+=ltrim(str(aRect[1]))+"|"+ltrim(str(aRect[2]))+"|"+ltrim(str( control:nWidth ))+"|"+ltrim(str( control:nHeight ))+"|"+ control:cTooltip +"| |"+alltrim( control:CAFONTS )+"|"+ltrim(str(control:NIDFOLDER))+"|"+ltrim(str(control:NPAGINA))+"|"
endif
next j
coor:=subs(coor,1,len(coor)-1)
FERASE(rclipper()+"fmtos\"+donde+".fmt")
MEMOWRIT(rclipper()+"fmtos\"+donde+".fmt",COOR)
//waitrun("NOTEPAD C:\"+CURDIR()+"\fmtos\"+donde+".fmt")
RETU .T.


// Agrega control en tiempo de ejecucion
Func AddGet(aGets,Dblclick)
local oGet, cText := Space( 120 ),n
Local coor:=GetCursorPos(oWndr:hWnd ),j:=1,control
Local cTYpe:=Upper("GBOX"),nBottom :=100,nRight :=100,nClrLite:= 0,nClrDark:= 0

If hayGroup
oGroup:Hide();oGroup:End();hayGroup:=.f.;aSelgroup:={}
endif
//local aRect:=GetCoors( oDlg:hWnd )
//COOR[1]:=COOR[1]-aRect[1] ;COOR[2]:=COOR[2]-aRect[2]
//oWndr:Settext("FILA "+LTRIM(STR(COOR[1]))+" COLUMNA "+LTRIM(STR(COOR[2])) )
//?"laclase",laclase

IF laclase="GROUP"// .and. !hayGroup
aadd(aGets,space(120)) ;n:=len(aGets)
oGet:=TSLines():New( coor[1],coor[2],coor[1]+100,coor[2]+100 , cType , oWndr, nClrLite, nClrDark, 0 , .t. , .F. , .t. , , , , .t. )
oGet :CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma"
oGet:cTooltip:="__BOX__"
oGet:NIDFOLDER:=0 // alinead a la izq
oGet:NPAGINA:=0 // color negro
oGet:lRounded:=.F.
oGet:Refresh()
ELSEif laclase="GET"
aadd(aGets,space(120)) ;n:=len(aGets)
oGet := TGet():New(coor[1],coor[2] , GynLocalBlock( aGets, n ) ,oWndr, 120, 20, , , , , , .T. , , .T. , , .T. , , .F. , .F. , , .F. , .F. , .F. ,, .F.,,,, )
oGet :CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma"
oGet:cTooltip:="Texto Normal"
oGet:NIDFOLDER:=0 // alinead a la izq
oGet:NPAGINA:=0 // color negro
//oGet:cVarName = ::GetVarName( oGet, "oGet" )
//oGet:l3D = .t.
ENDIF
//oWndr:Refresh()
//::RestoreStatus( oGet )
return nil

// Edita las propiedades ctooltip putGet , del Get y los guarda en el objeto
Func EditaoWnd(oWnd)
Local nAt := AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } ),oDlg,lExit:=.F.
Local cSgm:=oWnd:aControls[nAt]:cTooltip
Local cExp:=oWnd:aControls[nAt]:Varget()
Local caFonts:=oWnd:aControls[nAt]:caFonts
Local nBkMode:=oWnd:aControls[nAt]:nidfolder
Local nPad :=oWnd:aControls[nAt]:npagina
Local oGetC,oGetF
If hayGroup
oGroup:Hide();oGroup:End();hayGroup:=.f.;aSelgroup:={}
endif
If EMPTY(cSgm) ; cSgm:=SPACE(4)
else;cSgm:=cSgm+sPACE(4)
ENDIF
IF EMPTY( cExp ); cExp:=SPACE(200)
else ;cExp:=cExp+SPACE(80)
ENDIF
IF EMPTY(caFonts);caFonts:=SPACE(24);end
IF EMPTY(nBkMode);nBkMode:=space(3);end
IF EMPTY(nPad );nPad:=space(1);end

DEFINE DIALOG oDlg from 20,12 to 35,95 TITLE "Propiedades" //COLOR "W+/B" SIZE 50,295
@ 1, 3 SAY "Sgm " of oDlg
@ 1,8 GET cSgm of oDlg
@ 2, 3 SAY "Exp " of oDlg
@ 2,8 GET cExp of oDlg
@ 3, 3 SAY "Fonts " of oDlg
@ 3,8 GET oGetF VAR caFonts of oDlg
ogetf:bLDblClick:={ || ogetf:VarPut( cadfnt(oWnd:aControls[nAt]) ) }
@ 4, 3 SAY "nClrText " of oDlg
@ 4,8 GET oGetC VAR nBkMode of oDlg
ogetC:bLDblClick:={ || ogetC:VarPut( ltrim(str( ChooseColor() )) ) ,oWnd:aControls[nAt]:SetColor( ogetC:VarGet(), 16777215 ) }
@ 5, 3 SAY "nPad " of oDlg
@ 5,8 GET nPad of oDlg
@ 5, 5 BUTTON "&Ok" SIZE 40, 12 ACTION (lExit:=.T.,oDlg:End()) of oDlg
@ 5, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End() of oDlg
ACTIVATE DIALOG oDlg //NOWAIT

IF lExit
oWnd:aControls[nAt]:cTooltip:=cSgm
oWnd:aControls[nAt]:varPut( cExp )
oWnd:aControls[nAt]:caFonts =caFonts
oWnd:aControls[nAt]:nidfolder=nBkMode
oWnd:aControls[nAt]:nPagina=nPad
oWnd:aControls[nAt]:Refresh()
ENDIF
//MsgInfo( nAt )
retu .t.

func cadfnt(oCtrl)
local cFont:=CADFONT(CHOOSEFONT())
local ofont,aFont:=llenarray(cFont,0)
if valtype(cFont)!="U"; aFont:=llenarray(cFont,0)
//? "1",aFont[ LF_FACENAME ],"2",aFont[ LF_HEIGHT ],"3",aFont[ LF_WEIGHT ],"4",aFont[ LF_ESCAPEMENT ],"5",aFont[ LF_ORIENTATION ],"6",aFont[ LF_WEIGHT ],"7",aFont[ LF_ITALIC ],"8",aFont[ LF_UNDERLINE ],"9",aFont[ LF_STRIKEOUT ],"10",aFont[ LF_CHARSET ],"11",aFont[ LF_OUTPRECISION ],"12",aFont[ LF_CLIPPRECISION ],"13",aFont[ LF_QUALITY ],"14",aFont[ LF_PITCHANDFAMILY ]
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,;
! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),;
val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),;
val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.),;
IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.),;
val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]),;
val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),,;
val(aFont[ LF_PITCHANDFAMILY ]) )
oCtrl:SetFont( oFont )
//?" oFont:nWidth ",oFont:nWidth,"oFont:nHeight",oFont:nHeight
oCtrl:Refresh()
oFont:End()
endif
retu( cFont )


func cambiafuente(oWnd)
Local nAt := AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } )
if nAt=0;retu;end
oWnd:aControls[nAt]:caFonts := cadfnt(oWnd:aControls[nAt])
retu .t.

func cambiacolor(oWnd)
Local nAt := AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } )
if nAt=0;retu;end
oWnd:aControls[nAt]:nIdFolder:=ltrim(str( ChooseColor() ))
oWnd:aControls[nAt]:SetColor( val(oWnd:aControls[nAt]:nIdFolder), 16777215 )
retu .t.

func cambiaalin(oWnd,n)
Local nAt := AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } )
if nAt=0;retu;end
oWnd:aControls[nAt]:nPagina:=ltrim(str(n))
Do case
case n=1 // Izquierda
oWnd:aControls[nAt]:llCenter:=.f. ;oWnd:aControls[nAt]:llRight:=.f.
case n=2 // Derecha
oWnd:aControls[nAt]:llCenter:=.f. ;oWnd:aControls[nAt]:llRight:=.t.
case n=1 // Centro
oWnd:aControls[nAt]:llCenter:=.t. ;oWnd:aControls[nAt]:llRight:=.f.
Endcase
oWnd:aControls[nAt]:Refresh()
retu .t.

Func multipctrl(oWnd,aGets,vh)
local oGet, cText := Space( 120 ),n
Local nAt := AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } ),oDlg,lExit:=.F.
Local cSgm:=oWnd:aControls[nAt]:cTooltip
Local cExp:=oWnd:aControls[nAt]:Varget()
Local caFonts:=oWnd:aControls[nAt]:caFonts
Local nBkMode:=oWnd:aControls[nAt]:nidfolder
Local nPad :=oWnd:aControls[nAt]:npagina
Local nVeces:=2,j,fila:=oWnd:aControls[nAt]:nTop,colu:=oWnd:aControls[nAt]:nLeft
Local cTYpe:=Upper("GBOX"),nClrLite:= 0,nClrDark:= 0
if vh="V"
fila:=oWnd:aControls[nAt]:nTop+oWnd:aControls[nAt]:nHeight
else
colu:=oWnd:aControls[nAt]:nLeft+oWnd:aControls[nAt]:nWidth
endif
MsgGet("Multiplica","Cuantas veces",@nVeces)
For j=1 to nVeces
aadd(aGets,space(120)) ;n:=len(aGets)
if oWnd:aControls[nAt]:ClassName()="TGET"
oGet := TGet():New(fila,colu , GynLocalBlock( aGets, n ) ,oWnd, oWnd:aControls[nAt]:nWidth, oWnd:aControls[nAt]:nHeight, , , , , , .T. , , .T. , , .T. , , .F. , .F. , , .F. , .F. , .F. ,, .F.,,,, )
else
oGet:=TSLines():New( fila,colu,fila+oWnd:aControls[nAt]:nHeight,colu+oWnd:aControls[nAt]:nWidth, cType, oWnd, nClrLite, nClrDark, 0 , .t. , .F. , .t. , , , , .t. )
oGet:SetSize(oWnd:aControls[nAt]:nWidth,oWnd:aControls[nAt]:nHeight )
oGet:CAFONTS:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma"
oGet:cTooltip:="__BOX__"
oGet:NIDFOLDER:=0 // alinead a la izq
oGet:NPAGINA:=0 // color negro
oGet:lRounded:=.F.
oGet:Refresh()
endif
if vh="V"
fila+=oWnd:aControls[nAt]:nHeight
else
colu+=oWnd:aControls[nAt]:nWidth
endif
next j
//oWnd:Refresh()
//::RestoreStatus( oGet )
return nil


Func eliminactrl(oWnd)
Local nAt:=AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } )
if nAt=0;retu;end
oWnd:aControls[nAt]:Hide()
oWnd:aControls[nAt]:End()
if Len( oWnd:aControls ) == 0
ASend( oWnd:aDots, "Hide()" )
endif
retu .t.

Func pontooltip(oWnd,Texto)
Local nAt:=AScan( oWnd:aControls, { | oCtrl | oCtrl:lFocused } )
if nAt=0;retu;end
oWnd:aControls[nAt]:cTooltip:= Texto
oWnd:aControls[nAt]:Refresh()
retu .t.


Func implabel(oWnd,Funcparam,TITI,oScroll,posi,nTimp)//,condicion,evacondi)
Local t,j,j_,control,aRect,coor:="",exp,pdzo,mcrut,fila,colu,oFont,aFont,oFnt,nClrText
Local oPrn ,aImp:={},aCa,tip,aumfila:=0,incfila:=0,objsql,io,arrfonts:={},arrcol:={},myoFont
Local FAncho,FAlto
if empty(posi);posi:=1;end
arrto:={};arrbusto:={}
oScroll:HScrollPgUp();oScroll:HScrollPgUp();oScroll:HScrollPgUp();oScroll:HScrollPgUp()
oScroll:VScrollPgUp();oScroll:VScrollPgUp();oScroll:VScrollPgUp();oScroll:VScrollPgUp()
//oScroll:HScrollTrack(0) ;oScroll:VScrollTrack(0)
//oWnd:Refresh()
//if empty(nTimp)
// MSGSTOP("QUE PASA 580","POR FAVOR")
// tip:=Alert("de impresión ",{" Vista Previa "," D O S "," Archivo de Texto o ","Impresión Directa"},"Defina el tipo ")
//else
// MSGSTOP("QUE PASA 583","POR FAVOR")
tip:=nTimp
//endif
// MSGSTOP("QUE PASA 586","POR FAVOR")
If valtype(nTimp)="U"
tip:=1
Endif

if tip<4
tip:=1
endif
Do case
case tip=2 ; oPrn := TDosPrn():New("LPT1") ;oPrn:StartPage()
case tip=3 ; oPrn := TDosPrn():New("TEMP\P1.TXT");oPrn:StartPage()
case tip=4
PRINT oPrn TITLE TITI //PREVIEW MODAL
oPrn:SetPortrait()
PageBegin()
TIP:=1 // ESTA SALIDA ES UN CHALACASO
otherwise
PRINT oPrn TITLE TITI PREVIEW MODAL
//oPrn:SetSize(2100,2950) //359
FAncho = oPrn:nHorzRes() / 142
FAlto = oPrn:nVertRes() / 83

oPrn:SetPortrait()
PageBegin()

Endcase
If hayGroup;oGroup:Hide();oGroup:End();hayGroup:=.f.;aSelgroup:={};endif
IF TIP>1 // IMPRESION DOS
For j=1 to len(oWnd:aControls); control:=oWnd:aControls[j];aRect:=GetCoors( control:hWnd )
// if valtype(control:ctooltip)="U";control:ctooltip:="";end
exp:=Control:Varget()
Do case
case oWnd:aControls[j]:cToolTip=="Expresion xbase"
if vcerror(exp); exp:=&exp ; endif
case oWnd:aControls[j]:cToolTip=="Parametro de Funcion"
exp:=Funcparam+"("+chr(34)+exp+chr(34)+")"
if vcerror(exp); exp:=&exp ; endif
Endcase
if valtype(exp)="N" ; exp:=alltrim(str(exp)) ; endif
pdzo:=int(control:nWidth/GetTextWidth( 0,"|" ) )
aadd( aImp ,{ int(aRect[1]/10)*1000+int(aRect[2]/6),; // Order
int(aRect[1]/10),int(aRect[2]/6),exp,pdzo })
next j
aCa:=aSort( aImp,,,{ |x,y| x[1]<y[1] } )
// ACA RECIEN EMPIEZA LA IMPRESION
For j=1 to len(aca)
//? "FILA ",aca[j,2],"COLU",aca[j,3],"EXPRESION",subs(aca[j,4],1,aca[j,5])," CARACTERES QUE TOMA ",aca[j,5]
oPrn:Say(aca[j,2],aca[j,3],subs(aca[j,4],1,aca[j,5]) )
next j
oPrn:EndPage() // optional
oPrn:End()
if alltrim(upper(puerto))="LPT1"
else
WaitRun("NOTEPAD TEMP\P1.TXT")
endif
ELSE
// es necesario ordenar acontrols antes de imprimirlo
For j=1 to len(oWnd:aControls); control:=oWnd:aControls[j];aRect:=GetCoors( control:hWnd )
aadd( aImp ,{ int(aRect[1]/10)*1000+int(aRect[2]/6),oWnd:aControls[j]})
next j
aCa:=aSort( aImp,,,{ |x,y| x[1]<y[1] } )
For j=1 to len(aCa)
oWnd:aControls[j]:=aCa[j,2]
next j
For j=1 to len(oWnd:aControls); control:=oWnd:aControls[j];aRect:=GetCoors( control:hWnd )
if oWnd:aControls[j]:ClassName()="TREGLA"
loop
endif
if valtype(oWnd:aControls[j]:Varget())="U" .and. oWnd:aControls[j]:ClassName()="TGET"
loop
end

//?oWnd:aControls[j]:ClassName(),oWnd:aControls[j]:cToolTip,aRect[1]
if aRect[1]>=0 // no imprime negativos solucion para YAris
//?"area",select(),oWnd:aControls[j]:cToolTip,oWnd:aControls[j]:Varget(),oWnd:aControls[j]:cToolTip=="xbase a repetirse en todo el cursor"



IF oWnd:aControls[j]:ClassName()="TSLINES"

fila:= filcm2pix( aRect[1]/36, oPrn ) // /12.0*FALTO // 36 pixeles es una pulgada de alto
colu:= colcm2pix( aRect[2]/29, oPrn ) // /4.5*FANCHO // 29 pixeles es una pulgada de ancho
oPrn:Box( fila, Colu , fila + ((oWnd:aControls[j]:nHeight)/10.8*FALTO ) , Colu + ((oWnd:aControls[j]:nWidth)/4.0*FANCHO ) )

ELSEif oWnd:aControls[j]:cToolTip=="xbase a repetirse en todo el cursor"
objsql:=dameobjsql() ;arrto:=array(len(oWnd:aControls))
arrfonts:=array(len(oWnd:aControls))
arrcol:=array(len(oWnd:aControls))
arrbusto:=array(len(oWnd:aControls))
For t=1 to len(arrto);arrto[t]:=0;next t
aumfila:=0 ;j_:=j
VZMYBROW()
?"sgementos empiezan en ",j
For io=posi to len(objsql:aDbf) // objsql:Goto(io);objsql:Load()
objsql:nAt:=io
?"entro al bucle j_",j_
j_:=j
while j_<=len(oWnd:aControls) .and. oWnd:aControls[j_]:cToolTip=="xbase a repetirse en todo el cursor"
control:=oWnd:aControls[j_];aRect:=GetCoors( control:hWnd )
exp:=Control:Varget()
if vcerror(exp); exp:=&exp ; endif
if valtype(exp)="N" ; exp:=alltrim(str(exp))
arrto[j_]+=val(exp)
//?"incrementado arrto j_ ",j_,"con ",val(exp)
endif
pdzo:=int(control:nWidth/GetTextWidth( 0,"|" ) )
fila:= aRect[1]/36 // 36 pixeles es una pulgada de alto
colu:= aRect[2]/29 // 29 pixeles es una pulgada de ancho
if empty(oWnd:aControls[j_]:caFonts);oWnd:aControls[j_]:caFonts:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";end
IF EMPTY(oWnd:aControls[j_]:nidfolder);oWnd:aControls[j_]:nidfolder:=0;END
IF EMPTY(oWnd:aControls[j_]:npagina);oWnd:aControls[j_]:npagina:=0;END
aFont:=llenarray(oWnd:aControls[j_]:caFonts,0)
// oFn2 := TFont():New( cFont , 0 , - 8 , , .T. , , , , , , , , , , ,oPrn )
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[ LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.), IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.), val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]), val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),oPrn , val(aFont[ LF_PITCHANDFAMILY ]) )
nClrText:=oWnd:aControls[j_]:nidfolder
myoFont:=oFont
if !empty(arrto[j_])
//?"dentro del bucle ",j_,"fila", fila+aumfila,"colu",colu+2,exp ,"color",oWnd:aControls[j_]:nidfolder
arrfonts[j_]:=oFont ;arrcol[j_]:=colu
arrbusto[j_]:=Control:Varget()
endif
//?fila,aumfila,incfila //CmSay( nRow , nCol , cText, oFont, nWidth, nClrText , nBkMode, nPad ) // en centímetros
if oWnd:aControls[j_]:npagina=1; oPrn:CmSay( fila+aumfila+incfila,colu+2 , exp ,oFont , ,oWnd:aControls[j_]:nidfolder , , oWnd:aControls[j_]:npagina )
else ; oPrn:CmSay( fila+aumfila+incfila,colu , exp ,oFont , ,oWnd:aControls[j_]:nidfolder , , oWnd:aControls[j_]:npagina )
endif
oFont:End() ; oFont:=NIL
//?"j_ cuanto vale ",j_
j_++
enddo
aumfila:=aumfila+0.5
next io
objsql:nAt:=1
// imprime totales
// ?"qu emide len(arrto)",len(arrto)
//
// ESTOS TOTALES NO SE QUIEREN IMPRIMIR NUNCA
For t=1 to len(arrto)
if !empty(arrto[t])
//?t,arrto[t],empty(arrto[t]),"fila", fila+aumfila,"colu",arrcol[t]+2,nClrText," oFont ",myofont,myofont:ClassName()
//, nWidth, nClrText , nBkMode, nPad
//CmSay( nRow , nCol , cText , oFont , nWidth, nClrText , nBkMode, nPad ) // en centímetros
oPrn:CmSay( fila+aumfila+incfila,arrcol[t]+2 , arrto[t] ,myoFont , , 0 , , 1 )
endif
next t
//
IF NOaltfila ; aumfila:=0 ; ENDIF
j:=j_-1
// ?"sgementos terminan en ",j
elseif oWnd:aControls[j]:cToolTip=="xbase a repetirse en todo el array"
j_:=j
// ?"entro a array aAdic ",aAdic,len(aAdic)
// ?"sgementos empiezan en ",j
For io=1 to len(aAdic) // objsql:Goto(io);objsql:Load()
// ?"entro al bucle j_",j_
j_:=j
while j_<=len(oWnd:aControls) .and. oWnd:aControls[j_]:cToolTip=="xbase a repetirse en todo el array"
control:=oWnd:aControls[j_];aRect:=GetCoors( control:hWnd )
exp:=Control:Varget()
if valtype(exp)="C" ;exp:=val(exp);endif
exp:=aAdic[io,exp]
If valtype(exp)="N"
exp:=transform(exp,"999999999.99")
Endif
pdzo:=int(control:nWidth/GetTextWidth( 0,"|" ) )
fila:= aRect[1]/36 // 36 pixeles es una pulgada de alto
colu:= aRect[2]/29 // 29 pixeles es una pulgada de ancho
if empty(oWnd:aControls[j_]:caFonts);oWnd:aControls[j_]:caFonts:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";end
IF EMPTY(oWnd:aControls[j_]:nidfolder);oWnd:aControls[j_]:nidfolder:=0;END
IF EMPTY(oWnd:aControls[j_]:npagina);oWnd:aControls[j_]:npagina:=0;END
aFont:=llenarray(oWnd:aControls[j_]:caFonts,0)
// oFn2 := TFont():New( cFont , 0 , - 8 , , .T. , , , , , , , , , , ,oPrn )
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[ LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.), IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.), val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]), val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),oPrn , val(aFont[ LF_PITCHANDFAMILY ]) )
nClrText:=oWnd:aControls[j_]:nidfolder
//?"608",fila+aumfila+incfila,colu+2 , exp
//CmSay( nRow , nCol , cText, oFont, nWidth, nClrText , nBkMode, nPad ) // en centímetros
if oWnd:aControls[j_]:npagina=1; oPrn:CmSay( fila+aumfila+incfila,colu+2 , exp ,oFont , ,oWnd:aControls[j_]:nidfolder , , oWnd:aControls[j_]:npagina )
else ; oPrn:CmSay( fila+aumfila+incfila,colu , exp ,oFont , ,oWnd:aControls[j_]:nidfolder , , oWnd:aControls[j_]:npagina )
endif
oFont:End() ; oFont:=NIL
//?"j_ cuanto vale ",j_
j_++
enddo
incfila++
next io
//
IF NOaltfila ;incfila:=0;Endif
j:=j_
// ?"sgementos terminan en ",j 1234567
elseif UPPE(SUBS(oWnd:aControls[j]:cToolTip,1,7))=="SANGRIA"
exp:=Control:Varget()
if vcerror(exp); exp:=&exp ; endif
aParrafo:=sangria(exp,SUBS(oWnd:aControls[j]:cToolTip,8) ) // devuelve arreglo parrafo con la sangria respectiva
pdzo:=int(control:nWidth/GetTextWidth( 0,"|" ) )
fila:= aRect[1]/36 // 36 pixeles es una pulgada de alto
colu:= aRect[2]/29 // 29 pixeles es una pulgada de ancho
if empty(oWnd:aControls[j]:caFonts);oWnd:aControls[j]:caFonts:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";end
IF EMPTY(oWnd:aControls[j]:nidfolder);oWnd:aControls[j]:nidfolder:=0;END
IF EMPTY(oWnd:aControls[j]:npagina);oWnd:aControls[j]:npagina:=0;END
aFont:=llenarray(oWnd:aControls[j]:caFonts,0)
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[ LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.), IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.), val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]), val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),oPrn , val(aFont[ LF_PITCHANDFAMILY ]) )
For io=1 to len(aParrafo);exp:=aParrafo[io]
if valtype(exp)="N" ; exp:=alltrim(str(exp)) ; endif
if oWnd:aControls[j]:npagina=1; oPrn:CmSay( fila+aumfila+incfila,colu+2 , exp ,oFont , ,oWnd:aControls[j]:nidfolder , , oWnd:aControls[j]:npagina )
else ; oPrn:CmSay( fila+aumfila+incfila,colu , exp ,oFont , ,oWnd:aControls[j]:nidfolder , , oWnd:aControls[j]:npagina )
endif
incfila++
next io
oFont:End() ; oFont:=NIL
else
exp:=Control:Varget()
Do case
case oWnd:aControls[j]:cToolTip=="Expresion xbase" .OR. UPPE(oWnd:aControls[j]:cToolTip)=="EXPRESION XBASE PIES" .OR. UPPE(oWnd:aControls[j]:cToolTip)=="EXPRESION XBASE CABECERA"
//MSGSTOP(exp,"EXPRESION")
//vzmybrow()
if vcerror(exp); exp:=&exp ; endif
//MSGSTOP(exp,"lugo EXPRESION es ")
case oWnd:aControls[j]:cToolTip=="Parametro de Funcion"
// ?" cual es esa expresion que viota ",exp
exp:=Funcparam+"("+chr(34)+exp+chr(34)+")"
if vcerror(exp); exp:=&exp ; endif
Endcase
if valtype(exp)="N" ; exp:=alltrim(str(exp)) ; endif
pdzo:=int(control:nWidth/GetTextWidth( 0,"|" ) )
fila:= aRect[1]/36 // 36 pixeles es una pulgada de alto
colu:= aRect[2]/29 // 29 pixeles es una pulgada de ancho
if empty(oWnd:aControls[j]:caFonts);oWnd:aControls[j]:caFonts:="-11,0,0,0,400,F,F,F,0,3,2,1,34,Tahoma";end
IF EMPTY(oWnd:aControls[j]:nidfolder);oWnd:aControls[j]:nidfolder:=0;END
IF EMPTY(oWnd:aControls[j]:npagina);oWnd:aControls[j]:npagina:=0;END


aFont:=llenarray(oWnd:aControls[j]:caFonts,0)
// oFn2 := TFont():New( cFont , 0 , - 8 , , .T. , , , , , , , , , , ,oPrn )
IF len(aFont)>=14
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[ LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.), IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.), val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]), val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),oPrn , val(aFont[ LF_PITCHANDFAMILY ]) )
//CmSay( nRow, nCol, cText, oFont, nWidth, nClrText , nBkMode, nPad ) // en centímetros
Endif

if oWnd:aControls[j]:npagina=1; oPrn:CmSay( fila+aumfila+incfila,colu+2 , exp ,oFont , ,oWnd:aControls[j]:nidfolder , , oWnd:aControls[j]:npagina )
else ; oPrn:CmSay( fila+aumfila+incfila,colu , exp ,oFont , ,oWnd:aControls[j]:nidfolder , , oWnd:aControls[j]:npagina )
endif
if valtype(oFont)="O";oFont:End();end
oFont:=NIL
endif
endif
next j
PageEnd()
ENDPRINT
ENDIF
RETU .T.



/*
If nWidth > 0 .and. oFont != nil
cText:=Alltrim(cText)
DO WHILE ::GetTextWidth( cText, oFont ) > nWidth
cText:=Substr(cText,1,Len(cText)-1)
ENDDO
Endif

Si deseamos obtener una presentación vistosa o elegante podemos usar de:

Line( nTop, nLeft, nBottom, nRight, oPen ) // líneas
Box( nRow, nCol, nBottom, nRight, oPen ) // cajas
FillRect( aRect, oBrush ) // relleno

*/



/*
colu col

fila 1 50 51 1*1000+51 1051

fila 2 30 32 2*1000+30 2030
*/

Func muevelo(HV,n)
//aSelCtrls
Local j,control,aRect
If valtype(aSelCtrls)="A"
For j=1 to len(aSelCtrls);control:=aSelCtrls[j]
aRect:=GetCoors( control:hWnd )
If HV="V" ; control:Move(aRect[1]+(n*10),aRect[2])
else ; control:Move(aRect[1],aRect[2]+(n*10))
endif
control:Refresh()
next j
oWndr:Refresh()
endif
retu .t.

Func alinealo(q)
Local coGroup:=GetCoors( oGroup:hWnd ),aRect,j
Local filsup:=coGroup[1],filinf:=coGroup[3]
Local colsup:=coGroup[2],colinf:=coGroup[4]
If hayGroup
if len(aSelgroup)=0 // Captura los objetos del grupo por coordenadas
For j=1 to len(oWndr:aControls) ;control:=oWndr:aControls[j]
aRect:=GetCoors( control:hWnd )
if (aRect[1]>=filsup .and. aRect[3]<=filinf) .and. (aRect[2]>=colsup .and. aRect[4]<=colinf)
aadd(aSelgroup,control)
endif
next j
endif
//?"largo de aSelgroup ",len(aSelgroup)
For j=1 to len(aSelgroup);control:=aSelgroup[j]
aRect:=GetCoors( control:hWnd )
If q="F" ; control:Move(filsup,aRect[2])
else ; control:Move(aRect[1],colsup)
endif
control:Refresh()
next j
oWndr:Refresh()
else
MsgAlert("Arrastre y seleccione un grupo","Por Favor")
endif
retu .t.

func lleselGroup()
Local coGroup:=GetCoors( oGroup:hWnd )
Local j,control,arect
Local filsup:=coGroup[1],filinf:=coGroup[3]
Local colsup:=coGroup[2],colinf:=coGroup[4]
aSelgroup:={}
For j=1 to len(oWndr:aControls) ;control:=oWndr:aControls[j]
aRect:=GetCoors( control:hWnd )
if (aRect[1]>=filsup .and. aRect[3]<=filinf) .and. (aRect[2]>=colsup .and. aRect[4]<=colinf)
aadd(aSelgroup,control)
endif
next j
retu .t.

static Func vrSUM(xbase)
Local j:=1,n:=0
//?"analizando dentro de vrsum ",xbase
While j<=len(arrbusto)
if valtype(arrbusto[j])="C"
//?uppe(alltrim(arrbusto[j]))==uppe(alltrim(xbase)),arrbusto[j],xbase
if uppe(alltrim(arrbusto[j]))==uppe(alltrim(xbase)) ; n:=j
exit
endif
endif
j++
Enddo
if n>0
retu( arrto[n] )
else
retu(0)
endif

//FUNC MUEVETODO
//For j=1 to len(oWnd:aControls) ;control:=oWnd:aControls[j]
// aRect:=GetCoors( Control:hWnd )
// oWnd:aControls[j]:Move( aRect[1]-(oWnd:aControls[j]:nHeight/4),aRect[2] )
//Next j

Func todocambiafuente(oWnd)
local cFont:=CADFONT(CHOOSEFONT()),n
local ofont,aFont:=llenarray(cFont,0)
if valtype(cFont)!="U"; aFont:=llenarray(cFont,0)
//? "1",aFont[ LF_FACENAME ],"2",aFont[ LF_HEIGHT ],"3",aFont[ LF_WEIGHT ],"4",aFont[ LF_ESCAPEMENT ],"5",aFont[ LF_ORIENTATION ],"6",aFont[ LF_WEIGHT ],"7",aFont[ LF_ITALIC ],"8",aFont[ LF_UNDERLINE ],"9",aFont[ LF_STRIKEOUT ],"10",aFont[ LF_CHARSET ],"11",aFont[ LF_OUTPRECISION ],"12",aFont[ LF_CLIPPRECISION ],"13",aFont[ LF_QUALITY ],"14",aFont[ LF_PITCHANDFAMILY ]
oFont = TFont():New( aFont[ LF_FACENAME ],val(aFont[LF_WIDTH]), val(aFont[ LF_HEIGHT ]), .f.,;
! ( val(aFont[ LF_WEIGHT ]) == FW_NORMAL ),;
val(aFont[ LF_ESCAPEMENT ]), VAL(aFont[ LF_ORIENTATION ]),;
val(aFont[ LF_WEIGHT ]), IF(aFont[ LF_ITALIC ]="T",.T.,.F.),;
IF(aFont[ LF_UNDERLINE ]="T",.T.,.F.), IF(aFont[ LF_STRIKEOUT ]="T",.T.,.F.),;
val(aFont[ LF_CHARSET ]), val(aFont[ LF_OUTPRECISION ]),;
val(aFont[ LF_CLIPPRECISION ]), val(aFont[ LF_QUALITY ]),,;
val(aFont[ LF_PITCHANDFAMILY ]) )
endif
For n=1 to len(oWnd:aControls)
oWnd:aControls[n]:caFonts :=cFont
oWnd:aControls[n]:SetFont( oFont )
oWnd:aControls[n]:nHeight:=oFont:nHeight
oWnd:aControls[n]:Refresh()
next n
oFont:End()
retu .t.


Function myrLButtonDown( nRow, nCol, nFlags,oForm )
nBoxTop :=nRow ;nBoxLeft :=nCol ;nBoxBottom :=nRow ;nBoxRight :=nCol
oForm:Capture() ;MyrDrawBox(oForm:hwnd);lBoxDraw:=.T.
RETU .T.

Function myrMouseMove( nRow, nCol, nFlags,oForm )
If !nFlags==1 ; lBoxDraw:=.f. ; Endif// LBUTTON is DOWN !!!
// Bug in Not Getting WM_LButtonUp before WM_MOUSEMOVE !!!!
if lBoxDraw; MyrDrawBox(oForm:hWnd)
nBoxBottom = nRow ; nBoxRight = nCol ; MyrDrawBox(oForm:hWnd)
Return 0
endif
retu .t.

Function MyrLButtonUp( nRow, nCol, nFlags,oForm )
Local n,o
if lBoxDraw ;MyrDrawBox(oForm:hWnd);lBoxDraw = .f.
ReleaseCapture(); aSelCtrls:={} ;anClrpane:={}

For n=1 to len(oForm:aControls);o:=oForm:aControls[n];o:CoorsUpdate()
// ?"top",o:nTop,nBoxTop,"Left",o:nLeft,nBoxLeft,"Bottom ",o:nTop+o:nHeight,nBoxBottom,"Right",o:nLeft+o:nWidth,nBoxRight , o:nTop>nBoxTop .and. o:nLeft>nBoxLeft .and. o:nTop+o:nHeight<nBoxBottom .and. o:nLeft+o:nWidth<nBoxRight

If o:nTop>nBoxTop .and. o:nLeft>nBoxLeft .and. o:nTop+o:nHeight<nBoxBottom .and.;
o:nLeft+o:nWidth<nBoxRight
AADD(aSelCtrls,o) ;AADD(anClrpane,o:nClrPane)
o:bDragBloq:="movxmouse"
o:SetColor(0, 12632256) ;o:Refresh()
endif
Next n
endif
RETU .T.

/// funciones de alineacion decentes por fin

Function vzrllalinea(dire) // dire 1 arr 2 abjo 3 izq 4 der 5 width 6 height
Local j,vnTop:=0,vnLeft:=0,vnWidth:=0,vnHeight:=0
if dire=1;vnTop:=9999;end
if dire=3;vnLeft:=9999;end
If valtype(aSelCtrls)="A"
For j=1 to len(aSelCtrls)
Do case
case dire=1 // buscando el objeto que tengo la menor fila
if aSelCtrls[j]:nTop<vntop;vntop:=aSelCtrls[j]:nTop;end
case dire=2 // buscando el objeto que tenga la mayor fila
if aSelCtrls[j]:nTop>vntop;vntop:=aSelCtrls[j]:nTop;end
case dire=3 // buscando el objeto que tengo la menor colu
//? j,aSelCtrls[j]:nLeft,vnLeft
if aSelCtrls[j]:nLeft<vnLeft;vnLeft:=aSelCtrls[j]:nLeft;end
case dire=4 // buscando el objeto que tenga la mayor colu
if aSelCtrls[j]:nLeft>vnLeft;vnLeft:=aSelCtrls[j]:nLeft;end
case dire=5 // buscando el objeto que tenga la mayor ancho
if aSelCtrls[j]:nWidth>vnWidth;vnWidth:=aSelCtrls[j]:nWidth;end
case dire=6 // buscando el objeto que tenga la mayor altura
if aSelCtrls[j]:nHeight>vnHeight;vnHeight:=aSelCtrls[j]:nHeight;end
Endcase
Next j
For j=1 to len(aSelCtrls)
if dire=1 .or. dire=2 ;aSelCtrls[j]:nTop :=vnTop
elseif dire=3 .or. dire=4 ;aSelCtrls[j]:nLeft:=vnLeft
elseif dire=5 ;aSelCtrls[j]:nWidth :=vnWidth
elseif dire=6 ;aSelCtrls[j]:nHeight:=vnHeight
endif
aSelCtrls[j]:Refresh()
Next j
Endif
retu .t.

Func danrClrpane
Local j
If valtype(anClrpane)="A"
For j=1 to len(anClrpane)
aSelCtrls[j]:SetColor(aSelCtrls[j]:nClrText,anClrpane[j]);aSelCtrls[j]:Refresh()
aSelCtrls[j]:bDragBloq:=NIL
next j
aSelCtrls:={} ;anClrpane:={}
Endif
retu .t.

Function MyrDrawBox(hWnd )
RectDotted( hWnd, nBoxTop, nBoxLeft , nBoxBottom, nBoxRight )
retu .t.


Function sangria(linea,ancho)
Local aParrafo:={},palablin,ksep:=1
Local aPalabras,separa,j:=1,k
linea:=alltrim(linea);ancho:=val(ancho)
if empty(ancho);ancho:=60;end
aPalabras:=palabras(linea)//
//?"cuantas palabras hay en la linea",linea,len(aPalabras)
If len(linea)==ancho;aadd(aParrafo,linea)
elseif len(linea)<ancho // hay que repartir los blancos
separa:=space( int( (ancho-len(linea)) / len(aPalabras) ) )
linea:=""
For j=1 to len(aPalabras)
linea+=alltrim(aPalabras[j])+separa
next j
linea:=subs(linea,1,ancho) ;aadd(aParrafo,linea)
else // hay que armar un hermoso parrafo con sangria
linea:="";j:=1
while j<=len(aPalabras)
if len(linea+alltrim(aPalabras[j]))=ancho // incluye la palabra
aadd(aParrafo,linea+alltrim(aPalabras[j]) );linea:=""
elseif len(linea+alltrim(aPalabras[j]))>ancho // descarta la palabra ponlo en la otra linea
linea:=alltrim(linea); palablin:=palabras(linea)
//?"linea",linea,"ancho",ancho,"len(linea)",len(linea),"len(palablin)",len(palablin)
separa:=ancho-len(linea)
//?"LEN(SEPARA)",LEN(SEPARA)
linea:="";ksep:=1
For k=1 to len(palablin)
linea+=alltrim(palablin[k])+" "+space(ksep)
if k>separa;ksep:=0;endif
//?linea+"********"
next j
//linea:=subs(linea,1,ancho);
//?"linea",linea,len(linea)
aadd(aParrafo,linea);linea:=""
loop
else
linea+=alltrim(aPalabras[j])+" "
//?linea+"********"
endif
j++
enddo
endif
retu( aParrafo )

Func palabras(linea)
Local aPalabras:={},n
If at(" ",linea)>0
while at(" ",linea)>0
n:=at(" ",linea)
aadd(aPalabras,subs(linea,1,n-1) )
linea:=alltrim(subs(linea,n+1))
enddo
aadd(aPalabras,linea)
else
aadd(aPalabras,linea)
endif
retu(aPalabras)


Func filcm2pix( nRow ,oPrn )
nRow := Max( 0, ( nRow * 10 * oPrn:nVertRes() / oPrn:nVertSize() ) - oPrn:nYoffset )
retu(nRow)

Func colcm2pix( nCol ,oPrn )
nCol := Max( 0, ( nCol * 10 * oPrn:nHorzRes() / oPrn:nHorzSize() ) - oPrn:nXoffset )
retu(nCol)




//////////////////////////////////////////////////////////////////////////
// Mover grupo de controles con el mouse
////////////////////////////////////////////////////////////////////////
Func movxmouse( enfila,encolu )
Local oForm:=oWndr
Local j,control,aRect
If valtype(aSelCtrls)="A"
oLastForm:=oForm
For j=1 to len(aSelCtrls);control:=aSelCtrls[j]
aRect:=GetCoors( control:hWnd )
control:Move(aRect[1]+enfila,aRect[2]+encolu)
control:Refresh()
next j
oForm:Refresh()
endif
retu .t.

// LA CLASE TWORD

CLASS TWord
DATA oWord
DATA oDocs
DATA oActiveDoc
DATA oTexto
DATA oSelection
DATA cNombreDoc
DATA nLinea,nCol, nPage
DATA nYoffset, nXoffset
DATA lstartpag
DATA oLastSay
DATA lOverflowing
DATA nlastrow
DATA cTextOverflow
DATA lSetCm

DATA oOptions // Objeto Options [ Vikthor ]
DATA oMailMerge // Combinar correspondencia [ Vikthor ]
DATA oDataSource // Objeto MailMergeDataSource [ Vikthor ]
DATA oDataFields // Objeto MailMergeDataFields [ Vikthor ]
DATA oFields // Objeto MailMergeFields [ Vikthor ]
DATA oTables // Objeto Tables [ Vikthor ]

METHOD AddImagen( nTop, nLeft, nBottom, nRight, cImagen, alinea, ntipo, nrotacion )
METHOD addtabulador(npos, ocuadrotext)
METHOD Box( nTop, nLeft, nBottom, nRight, afondo, alinea, ntipo, nrotation, lsimple )
METHOD close()
METHOD CmSay( nLin,nCol,cTexto,oFuente,nSizeHorz,nClrText,nBkMode,nPad, naltura, nColorIndex, lVertAdjust )
METHOD CheckSpelling()
METHOD End()
METHOD EndPage()
METHOD FillRect( aRect, oBrush )
METHOD GetTextHeight( oFont )
METHOD GetTextWidth(cText, oFont)
METHOD GoBottom() INLINE ::oTexto:Invoke( 'EndKey', 6)
METHOD GoTop() INLINE ::oTexto:Invoke( 'HomeKey', 6)
METHOD JustificaDoc( nJustify, otext )
METHOD Line( nTop, nLeft, nBottom, nRight, oPen, nColor, nStyle )
METHOD New()
METHOD NewDoc( cNombreDoc )
METHOD nLogPixelX() INLINE 55.38
METHOD nLogPixelY() INLINE 55.38
METHOD OpenDoc( cNombreDoc )
METHOD Preview()
METHOD PrintDoc(lbackground, lappend, nRange, cOutputFile, nfrom, nto, nitem, ncopias, cpages)
METHOD Protect(cpassword,nmodo)
METHOD Replace( cOld, cNew )
METHOD Save(cnombredoc)
METHOD Say( nLin,nCol,cTexto,oFuente,nSizeHorz,nClrText,nBkMode,nPad, naltura, nColorIndex, lvertadjust )
METHOD Say2( nLin,nCol,cTexto,oFuente, nSize, lBold, lShadow, nColor )
METHOD SayGTF( nTop,nLeft, cTextFormat, nBottom,nRight )
METHOD SetCm()
METHOD SetHeader()
METHOD SetLandScape()
METHOD SetMainDoc()
METHOD SetPortrait()
METHOD SetUl()
METHOD StartPage()
METHOD TabClearAll(ocuadrotext)
METHOD TabPredeterminado(ncada)
METHOD TextBox( nTop, nLeft, nBottom, nRight, cTexto, oFuente, nclrtext, nClrBack, nJustify, afondo, alinea, lvertadjust, norientacion)
METHOD UnProtect(cpassword)
METHOD VistaCompleta()
METHOD Visualizar INLINE ::oWord:Visible := .T.
METHOD Write( cTexto, cFuente, cSize, lBold, lShadow, nColor )
METHOD Sendmail( lAttach ) // [ Vikthor ]
METHOD HeaderFooter( nOption ) // [ Vikthor ]
METHOD OpenDataSource( cFile ) // [ Vikthor ]
METHOD AddField( cField ) // [ Vikthor ]
METHOD WebPagePreview() INLINE ::oActiveDoc:Get("WebPagePreview") // [ Vikthor ] Genera una vista en HTML del libro.
METHOD AddTables( nRows , nCols , aDatos ) // [ Vikthor ]
METHOD View( nView ) // [ Vikthor ]
METHOD Zoom(nPercent)
ENDCLASS


METHOD AddImagen( nTop, nLeft, nBottom, nRight, cImagen, alinea, ntipo, nrotacion ) CLASS TWord

::Box(nTop, nLeft, nBottom, nRight, {,,,,,,,cImagen}, alinea, ntipo, nrotacion, .t.)
ME INTERESA FW Y XHB POR SER OPEN SOURCE
Vladimir Zorrilla
 
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Postby VeRCE » Tue Apr 18, 2006 7:41 pm

Perdona, no me lo tomes a mal pero creo que era mas fácil
para todos si hubieras publicado este codigo para descargar.

Saludos
Juan Carlos Salinas Ojeda
México. D.F.
-------------------------------------------------
User avatar
VeRCE
 
Posts: 219
Joined: Fri Nov 04, 2005 2:34 pm
Location: Mexico D.F.

Postby Antonio Linares » Wed Apr 19, 2006 8:47 am

Vladimir,

Te digo lo mismo que Juan Carlos. Por favor la próxima vez usa www.hyperupload.com y pon sólo el link de descarga del fichero con el código. gracias.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Vladimir Zorrilla » Wed Apr 19, 2006 8:42 pm

mil disculpas desconocia del procedimiento.

De todos modos agradeceria si alguien me absuelve la consulta.



Gracias
ME INTERESA FW Y XHB POR SER OPEN SOURCE
Vladimir Zorrilla
 
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Postby ralph » Fri Apr 21, 2006 9:20 pm

trate de compilar tu codigo, pero parece que paso incompleto. Si puedes enviamelo a mi email. rdelcastillo@consorcioinformatico.com


Ralph
User avatar
ralph
 
Posts: 70
Joined: Fri Nov 18, 2005 11:15 pm
Location: Lima - PERU

Postby Silvio » Fri Nov 03, 2006 12:35 am

Vladimir,
can you send me at private email your visual designer for label ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests