Letra Tachada - SOLUCIONADO

Letra Tachada - SOLUCIONADO

Postby leandro » Mon Sep 16, 2019 8:33 pm

Buenas tardes para todos,

requiero definir un tipo de fuente el cual se muestre tachado, Lo intente de la siguiente manera pero no funciona, cabe aclarar que requiero usarlo dentro de un xbrowse.

Code: Select all  Expand view  RUN

Define Font oFont Name "Arial" Size 0,-13 Bold
oFont :lStrikeOut :=.t.
 


De antemano gracias
Last edited by leandro on Thu Sep 19, 2019 7:30 pm, edited 1 time in total.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Letra Tachada

Postby karinha » Mon Sep 16, 2019 8:42 pm

Code: Select all  Expand view  RUN

Define Font oFont Name "Arial" Size 0,-13 Bold UnderLine
 


No sirve?
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Letra Tachada

Postby leandro » Mon Sep 16, 2019 11:27 pm

Gracias por responder karinha

Pero no es lo que necesito.

De antemano gracielas
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Letra Tachada

Postby FranciscoA » Tue Sep 17, 2019 12:24 am

leandro:
Tenés que usar una fuente específica para eso.

Aquí un ejemplo:
Code: Select all  Expand view  RUN
Function PruebaFont()
local oStrike, cStrikeFont := ".\Lightstrike_Trial.ttf", cNombre := "LIGHTSTRIKE"

    AddFontResource( cStrikeFont )  // font no está instalada en windows

   DEFINE FONT oStrike NAME cNombre  SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 500,240 PIXEL

   @ 05, 120 SAY "PROBANDO PROBANDO" SIZE 100,40 PIXEL OF oDlg  FONT oStrike

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT  oStrike

return nil
 

Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Letra Tachada

Postby karinha » Tue Sep 17, 2019 1:30 pm

Code: Select all  Expand view  RUN

// \SAMPLES\TACHADA.PRG
// Download:
// https://www.wfonts.com/font/lightstrike

#include "Fivewin.ch"

FUNCTION PruebaFont()

   LOCAL oStrike, cStrikeFont := ".\Lightstrike_Trial.ttf",                  ;
         cNombre := "LIGHTSTRIKE"
   LOCAL oDlg

                                   // https://www.wfonts.com/font/lightstrike
   AddFontResource( cStrikeFont )  // font no está instalada en windows

   DEFINE FONT oStrike NAME cNombre  SIZE 0,-14 BOLD

   DEFINE DIALOG oDlg SIZE 500, 240 PIXEL

   @ 05, 120 SAY "PROBANDO FONT LIGHTSTRIKE" SIZE 100,40 PIXEL OF oDlg       ;
      FONT oStrike

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT  oStrike

   RemoveFontResource( ".\Lightstrike_Trial.ttf" )

RETURN NIL
 


Saludos e gracias, Francisco.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7848
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Letra Tachada

Postby leandro » Tue Sep 17, 2019 7:08 pm

Francisco Gracias por responder...

Compile el ejemplo y funciona correctamente, también lo agregue al xbrowse y funciono correctamente; pero me surge otro problema, requiero cambiar la fuente de acuerdo a una condición, buscando el foro encontré algo similar a lo que requiero hacer y que tu también respondiste.

Code: Select all  Expand view  RUN

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), ;
                        if(cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value )="A","Anulada","Activa") ) }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont   
    oCol:oDataFont := {|| if( cValtoChar(oRsFtr:Fields( "ll_anulad" ):Value) = "A", oTachada, oFont1) } //linea del error
 


La idea es que si el campo esta marcado como "A" muestre la letra tachada, de lo contrario no. El problema es que me arroja el siguiente error:

Code: Select all  Expand view  RUN

Stack Calls
===========
   Called from:  => ACTIVATE( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 13787 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 13445 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 2335 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 2033 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1767 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11218 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
   Called from:  => DIALOGBOXINDIRECTW( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 436 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 23 )
   Called from:  => ACTIVATE( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 13787 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 13445 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 2335 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 2033 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1767 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11218 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1078 )
   Called from: c:\dlyma\prg\R32_menu.prg => MAIN( 466 )
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Letra Tachada

Postby cnavarro » Tue Sep 17, 2019 11:52 pm

Este código me funciona correctamente

Code: Select all  Expand view  RUN

   DEFINE FONT oFntW NAME  "Calibri"   SIZE 0,-12
   DEFINE FONT oFntS NAME  "Calibri"   SIZE 0,-14 STRIKEOUT
   DEFINE FONT oFntB NAME  "Calibri"   SIZE 0,-14 BOLD

  .../...

  @ nR, nC XBROWSE oBrw ....

   WITH OBJECT oBrw
      :SetFont( oFntW )

    .../...

      WITH OBJECT :oCol( 1 )
         :nWidth := 350
         :oDataFont := { | o | if( Upper( Left( o:Value, 1 ) ) = "A", oFntB, oFntS ) }
      END
      :CreateFromCode()
   END


 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Letra Tachada

Postby FranciscoA » Wed Sep 18, 2019 12:45 am

leandro:
En tu versión que es reciente, debería funcionar como lo dice Cristóbal.
En mi version FW1204 he buscado en el include y aunque aparece definido STRIKEOUT, me da error, por lo que tengo que usar la font de terceros.
No aparece en el #xcommand DEFINE FONT <oFont>.

Code: Select all  Expand view  RUN
FUNCTION LetraTachada()
local oDlg, oBrw, cAlias, n, n2, cConc, nVal:=0, cCampo, oFont
local oStrike, cStrikeFont := ".\Lightstrike_Trial.ttf", cNombre := "LIGHTSTRIKE"

   AddFontResource( cStrikeFont )  // font no está instalada en windows

   DEFINE FONT oStrike   NAME cNombre    SIZE 0,-14 BOLD
   DEFINE FONT oFont     NAME "Arial"  SIZE 0,-14

if !File(".\OrdByRow.dbf")
   dbCreate(".\OrdByRow",{ { "Concepto", "C", 20,0 } ,;
                           { "Col_1"   , "N",  4,0 } ,;
                           { "Col_2"   , "N",  4,0 } ,;
                           { "Col_3"   , "N",  4,0 } ,;
                           { "Col_4"   , "N",  4,0 } ,;
                           { "Col_5"   , "N",  4,0 } } )

   DBUsearea(.t.,,".\OrdByRow","OrdByRow",.t.)

   For n := 1 to 5
      cConc := "Concepto "+ alltrim(str(n,4))
      if n = 2 .or. n = 4
         cConc := "Anulada"
      endif

      dbappend()

      field->concepto := cConc

      For n2 := 1 to 5
         cCampo := "Col_"+alltrim(str(n2))
         nVal := nRandom( 100 )
         Field->&cCampo := nVal
      Next
   Next

   OrdByRow->(dbcloseArea())
   SysRefresh()
endif

   DBUsearea(.t.,,".\OrdByRow","OrdByRow",.t.)
   cAlias:=Alias()

   DEFINE DIALOG oDlg SIZE 500, 240 PIXEL

   @ 10,30 SAY "PROBANDO FONT LIGHTSTRIKE BOLD ( LETRA TACHADA )" SIZE 200,30 PIXEL OF oDlg FONT oStrike

   @ 2, 0 XBROWSE oBrw OF oDlg PIXEL SIZE 230,80 ;
          DATASOURCE cAlias ;
          AUTOCOLS FOOTERS CELL LINES

   WITH OBJECT oBrw
      :Concepto:oDataFont := {| o | if(upper(substr(alltrim(o:Value),1,1))=="A", oStrike, oFont) }
   END

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED  ON INIT ( oBrw:Move(60,20) )

   (cAlias)->(DbCloseArea())
   Ferase(".\OrdByRow.dbf")
   RELEASE FONT oStrike, oFont
   RemoveFontResource( ".\Lightstrike_Trial.ttf" )

RETURN NIL
 

Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Letra Tachada

Postby leandro » Wed Sep 18, 2019 1:27 am

Como siempre muchas gracias por la ayuda Cristobal

Lo hice como mencionaste pero sigue arrojando el mismo error

Code: Select all  Expand view  RUN

Define Font oFontT Name "Calibri" Size 0,-13 STRIKEOUT
Define Font oFontN Name "Calibri" Size 0,-13
....

...

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), ;
                        if(cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value )="A","Anulada","Activa") ) }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont   
    oCol:oDataFont := {|o| if( Upper( Left( o:Value, 1 ) ) = "A", oFontT, oFontN ) }

 


Es muy raro ese error, por que el error que reporta esta en otro prg :shock:

Code: Select all  Expand view  RUN

   Args:
     [   1] = U  
     [   2] = N   -1677652388

Stack Calls
===========
   Called from:  => ACTIVATE( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 13787 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 13445 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 2335 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 2033 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1767 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11218 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
   Called from:  => DIALOGBOXINDIRECTW( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 436 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 23 )
   Called from:  => ACTIVATE( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 13787 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 13445 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 2335 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 2033 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1767 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11218 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1078 )
   Called from: c:\dlyma\prg\R32_menu.prg => MAIN( 466 )
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Letra Tachada

Postby FranciscoA » Wed Sep 18, 2019 2:53 am

Leandro, intentalo asi. ( me funciona )
Code: Select all  Expand view  RUN
oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), ;
                        if(cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value )="A","Anulada","Activa") ) }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont  
 //   oCol:oDataFont := {|o| if( Upper( Left( o:Value, 1 ) ) = "A", oFontT, oFontN ) }


   oCol          = oBrwFt:AddCol()   //ultima col agregada
  ...
  ...

  oBrw:aCols[n]:oDataFont := {|o| if(upper(left(o:Value,1)) ="A",oFontT,oFontN)}     //colocarlo despues de creadas todas las oCol y antes del CreateFrom...
 //oBrw:aCols[n] :  reemplazar n con el numero de orden de creacion de la columna

  oBrw:CreateFrom...

 

Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Letra Tachada

Postby leandro » Wed Sep 18, 2019 3:29 am

Gracias por la idea francisco, pero sigue sin funcionar.... :(

Este es todo el código
Code: Select all  Expand view  RUN

**************************
*FACTURAS DE VENTA
**************************
FUNCTION fFacturas()

REQUEST FWZEBRA

Local aCol:={0,0,0,0,0,0,0,0,0,0,0,0,0},nWidth:=0
Local aCols:={0,0,0}
Local vGet2:="get2",vGet1:="get1",uVar,cText:=space(15)
Local oExpPqr, oPanel1, oPanel2, oPanel3, oPanel4
Local oSplitV
Local aGrad   := { { CLR_WHITE,  RGB( 51, 153, 255 ) },;
                 { CLR_WHITE,  RGB( 51, 153, 255 ) } }
Local vGBus := space(100)

//CONSULTA DEL LISTADO DE LAS FACTURAS
oVar:="SELECT FAC.*,SUM(MOV.mm_subtot) AS subtotal,"+;
"SUM(MOV.mm_basiva) AS base,"+;
"SUM(MOV.mm_valiva) AS iva,"+;
"SUM(MOV.mm_totale) AS total,"+;
"CONCAT(t_razons,' ',t_prinom,' ',t_segnom,' ',t_priape,' ',t_segape) AS nombre,TER.t_ciudad,"+;
"BOD.b_nombre,DOC.*"+;
" FROM ((("+oLamcla:tFact+" FAC"+;
" LEFT JOIN "+oLamcla:tMofa+" MOV ON FAC.ll_consec=MOV.mm_consec)"+;
" LEFT JOIN "+oLamcla:tTerc+" TER ON FAC.ll_tercer=TER.t_tercer)"+;
" LEFT JOIN "+oLamcla:tBode+" BOD ON FAC.ll_bodega=BOD.b_bodega)"+;
" LEFT JOIN "+oLamcla:tDofa+" DOC ON FAC.ll_docume=DOC.ee_codigo"+;
" GROUP BY FAC.ll_consec ORDER BY FAC.ll_docume,FAC.ll_consec + 0"
//el + 0 Es para que mysql tome en campo consecutivo como numero
oRsFtr := FW_OPENRECORDSET(oCnFtr,oVar,adLockOptimistic,adOpenKeyset)

Define Font oFont  Name "Calibri" Size 0,-13 BOLD
Define Font oFont1 Name "Calibri" Size 0,-13
Define Font oFont2 Name "Calibri" Size 0,-20 BOLD

Define Font oFontT Name "Calibri" Size 0,-13 STRIKEOUT
Define Font oFontN Name "Calibri" Size 0,-13

DEFINE WINDOW oWChPq MDICHILD TITLE "Facturas de Venta" ICON "#8001" OF oWnd

    SET MESSAGE OF oWChPq TO "Facturas de Venta" 2010

   oExpPqr = TExplorerBar():New( 00, 00, 240, oWChPq:nHeight, oWChPq )
   oExpPqr:nTopColor := RGB( 215, 215, 215 )
   oExpPqr:nBottomColor := RGB( 215, 215, 215 )  
   
   oPanel1 = oExpPqr:AddPanel( "FACTURAS DE VENTA", "#8068", , 30, 0, aGrad, , CLR_WHITE, CLR_WHITE )
   oPanel1:AddLink( "Agregar Fact. ", {|| manteFacturas(0) }, "#8203" )
   oPanel1:AddLink( "Modificar Fact.", {|| manteFacturas() }, "#8202" )
   oPanel1:AddLink( "Anular Fact.", {|| msginfo("Sin Acceso") }, "#8204" )
   oPanel1:AddLink( "Importar JSON", {|| leerdirectorio() }, "#8210" )
   oPanel1:nClrHover := RGB( 213, 234, 255 )

   oPanel2 = oExpPqr:AddPanel( "REPORTES", "#8067", , 25, 0 )
   oPanel2:SetColor( RGB( 0, 0, 255 ), CLR_WHITE)   
   oPanel2:AddLink( "Certificado Trazabilidad", {|| impTrazabilidad() }, "#8209" )
   oPanel2:AddLink( "Configurar Impresora", {|| PrinterSetup() }, "#8205" )

   oPanel3 = oExpPqr:AddPanel( "FACT.ELECTRÓNICA", "#8066", , 25, 0 )
   oPanel3:SetColor( RGB( 0, 0, 255 ), CLR_WHITE)
   oPanel3:AddLink( "Enviar DIAN ", {|| msginfo("enviamos a la DIAN") }, "#8206" )
   oPanel3:AddLink( "Consular Estado ", {|| EnviarEST(oRsFtr:Fields( "ll_consec" ):Value) }, "#8211" )

   oPanel4 = oExpPqr:AddPanel( "BUSQUEDA ", "#8099", 40 )
   oPanel4:SetColor( RGB( 0, 0, 255 ), CLR_WHITE)
   @ 33,11 GET oGBus VAR vGBus OF oPanel4 SIZE 147,23 PIXEL VALID (buscaInfo(vGBus),.t.) PICTURE "@N"
   oGBus:bGotFocus := {|| oGBus:SelectAll(.T.) }
   @ 33,160 BUTTONBMP of oPanel4 pixel size 23, 23 BITMAP "#8212" ACTION buscaInfo(" ") TOOLTIP "Limpiar Filtro"

   oPanel5 = oExpPqr:AddPanel( "SALIDA", "#8070", , 25, 0 )
   oPanel5:SetColor( RGB( 0, 0, 255 ), CLR_WHITE)
   oPanel5:AddLink( "Cerrar Ventana", {|| oWChPq:End() }, "#8207" )

    oBrwFt := TXBrowse():New( oWChPq )
    oBrwFt:nMarqueeStyle         := MARQSTYLE_HIGHLROW
    oBrwFt:nRowDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwFt:nColDividerStyle      := LINESTYLE_LIGHTGRAY
    oBrwFt:nHeaderLines          := 1
    oBrwFt:lColDividerComplete   := .t.
    oBrwFt:lRecordSelector       := .t.
    oBrwFt:nStretchCol           := STRETCHCOL_LAST
    oBrwFt:l2007                 := .f.
    oBrwFt:oFont                 := oFont1  
    oBrwFt:nLeft                 := 243 // DISTANCIA DESDE EL BORDER IZQ.
    oBrwFt:bLDblClick            := {|nRow, nCol| manteFacturas() }
    oBrwFt:bKeyDown              := {|nKey,oGet,nCol|TeclasFtr(nKey,oGet,nCol)}
   
    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), TRANSFORM( oRsFtr:Fields( "ll_consec" ):Value ,"9999999999" ) ) }
    oCol:cHeader  = "Consec."
    oCol:nWidth   = 65
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont   

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), cValtoChar( oRsFtr:Fields( "ll_contro" ):Value ) ) }
    oCol:cHeader  = "Tipo"
    oCol:nWidth   = 40
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), DTOC(oRsFtr:Fields("ll_fechas" ):Value) ) }
    oCol:cHeader  = "Fecha Factura"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont
   
    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), cValtoChar( oRsFtr:Fields( "ll_tercer" ):Value ) ) }
    oCol:cHeader  = "Tercero"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont   

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), alltrim( cValtoChar( oRsFtr:Fields( "nombre" ):Value ) ) ) }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 300
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), ;
                        if(cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value )="A","Anulada","Activa") ) }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont   

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), Transform(oRsFtr:Fields( "subtotal" ):Value,oLamcla:PIC7) ) }
    oCol:cHeader  = "Sub Total"
    oCol:nWidth   = 85
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), Transform(oRsFtr:Fields( "base" ):Value,oLamcla:PIC7) ) }
    oCol:cHeader  = "Base I.V.A."
    oCol:nWidth   = 85
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), Transform(oRsFtr:Fields( "iva" ):Value,oLamcla:PIC7) ) }
    oCol:cHeader  = "I.V.A."
    oCol:nWidth   = 85
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont

    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), Transform(oRsFtr:Fields( "total" ):Value,oLamcla:PIC7) ) }
    oCol:cHeader  = "Total"
    oCol:nWidth   = 85
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT   
    oCol:oHeaderFont = oFont

    oBrwFt:SetADO( oRsFtr )
    //oBrwFt:aCols[6]:oDataFont := {|o| if(upper(left(o:Value,1)) ="A",oFontT,oFontN)}
    oBrwFt:CreateFromCode()

    @ 00,240 SPLITTER oSplitV VERTICAL ;
        PREVIOUS CONTROLS oExpPqr ;
        HINDS CONTROLS oBrwFt ;
        SIZE 1, oWChPq:nHeight PIXEL ;
        OF oWChPq ;
        3DLOOK UPDATE

    oSplitV:lStatic:=.t.

    oBtF4:disable()
    oWChPq:bPostEnd := { || oRsFtr:Close(),oCnFtr:Close() }

ACTIVATE WINDOW oWChPq  MAXIMIZED ON INIT (oBrwFt:goBottom(),oBrwFt:setfocus()) ON RESIZE( oExpPqr:AdjLeft(), oSplitV:AdjClient(), oSplitV:AdjRight() ) VALID(oBtF4:enable(),.t. )

 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Letra Tachada

Postby FranciscoA » Wed Sep 18, 2019 5:21 pm

Leandro:
Nunca he usado ADO, por lo que he decidido presentarte este ejemplo funcional, siguiendo la logica OOP que usas.
Tomar en cuenta que uso una FONT de terceros.
Code: Select all  Expand view  RUN
Function MisFacts()
local oDlg, oBrw, oCol, oFont, oStrike
local cStrikeFont := ".\BPtypewriteStrikethrough.ttf"  
local cNombre     := "BPtypewriteStrikethrough"
local dFecha := Ctod("09/01/2019"), n

AddFontResource( cStrikeFont )  // font no está instalada en windows

    DEFINE FONT oStrike   NAME cNombre    SIZE 0,-14 BOLD
    DEFINE FONT oFont     NAME "Calibri"  SIZE 0,-14

if !File(".\MisFacts.dbf")
   dbCreate(".\MisFacts",{ { "NumeFact",  "N",  6,0 } ,;
                           { "TipoFact",  "C",  2,0 } ,;
                           { "FechaFact", "D",  8,0 } ,;
                           { "Estado"   , "C",  1,0 } ,;
                           { "Cliente"  , "C", 25,0 } } )

   DBUsearea(.t.,,".\MisFacts","MisFacts",.t.)

   For n := 1 to 6
      dbappend()

      field->NumeFact := 100 + n
      field->TipoFact := if(field->NumeFact=102 .or. field->NumeFact=104, "CO","CR")
      field->FechaFact := dFecha ++
      field->Estado := if(field->NumeFact=102 .or. field->NumeFact=104, "A"," ")
      Field->Cliente := "Francisco " + Str(field->NumeFact,3)
   Next

   MisFacts->(dbcloseArea())
   SysRefresh()
endif

   DBUsearea(.t.,,".\MisFacts","MisFacts",.t.)
   MisFacts->(dbgotop())

   DEFINE DIALOG oDlg SIZE 500, 240 PIXEL

   @ 10,30 SAY "PROBANDO FONTs STRIKEOUT Y STRIKETHROUGH  ( LETRA TACHADA )" SIZE 200,30 PIXEL OF oDlg FONT oStrike

    oBrw := TXBrowse():New( oDlg )
    oBrw:nStretchCol           := STRETCHCOL_LAST

   
    oCol          = oBrw:AddCol()
    oCol:bEditValue = { || Field->NumeFact }
    oCol:cEditPicture = "9999999"
    oCol:cHeader  = "Consec"
    oCol:nWidth   = 65
    oCol:nHeadStrAlign = AL_RIGHT
    oCol:nDataStrAlign = AL_RIGHT  
    oCol:oHeaderFont = oFont  

    oCol          = oBrw:AddCol()
    oCol:bEditValue = { || Field->TipoFact }
    oCol:cEditPicture = "@|"
    oCol:cHeader  = "Tipo"
    oCol:nWidth   = 40
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont

    oCol          = oBrw:AddCol()
    oCol:bEditValue = { || field->FechaFact }
    oCol:cHeader  = "Fecha Factura"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont
   
    oCol          = oBrw:AddCol()        //Column 4
    oCol:bEditValue = { || if(field->Estado ="A","Anulada","Activa") }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont  

    oCol          = oBrw:AddCol()
    oCol:bEditValue = { || Field->Cliente }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 300
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont
 
    oBrw:aCols[4]:oDataFont := {|o| if(upper(left(o:Value,4)) ="ANUL",oStrike,oFont) }

    oBrw:CreateFromCode()
    oBrw:SetRDD()

    ACTIVATE DIALOG oDlg CENTERED ;
             ON INIT ( oBrw:SetSize(oDlg:nWidth-40, oDlg:nHeight-90),;
                       oBrw:Move(60,20) )

   MisFacts->(DbCloseArea())
   Ferase(".\MisFacts.dbf")
   RELEASE FONT oStrike, oFont
   RemoveFontResource( cStrikeFont )

RETURN NIL
 

Saludos
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Letra Tachada

Postby leandro » Thu Sep 19, 2019 7:30 pm

Gracias por responder Franciso, realice pruebas con tu ejemplo y me dio la siguiente idea, la cual funciona correctamente.

De nuevo muchas gracielas a todos por la ayuda.

Code: Select all  Expand view  RUN

......
    oCol          = oBrwFt:AddCol()
    oCol:bStrData = { || If( oRsFtr:Eof, Space( nWidth ), nombreEstado( cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value ) ) ) }
    oCol:cHeader  = "Estado"
    oCol:nWidth   = 90
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont   
    oCol:oDataFont   := {|| tipoLetra( cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value ) ) }
    oCol:bClrStd      = {|| {CLR_BLACK,colorEstado2( cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value ) ) }  }
    oCol:bClrSelFocus = {|| {CLR_WHITE,colorEstado( cValtoChar( oRsFtr:Fields( "ll_anulad" ):Value ) ) }  }
.....

************************
*CAMBIA EL TIPO DE LETRA
************************
Function tipoLetra(valor)
Define Font oFontT Name "Calibri" Size 0,-13 STRIKEOUT
Define Font oFontN Name "Calibri" Size 0,-13
IF valor=="A"
    Return oFontT
ELSE
    Return oFontN
ENDIF



....


 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1676
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 70 guests