quiero definir fuentes que esten disponible en toda la app

Post Reply
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

quiero definir fuentes que esten disponible en toda la app

Post by goosfancito »

ola.
tengo varias clases, cada una hace su cometido en la app,
y todas tienen browser.

quier definir "algo" pienso en una clase pero no me estaria funcionando, para definir algunas fuentes y que pueda
utilizarla desde las diferentes clases que tengo.
he hecho esto:

Code: Select all | Expand

CLASS TFuentes
   DATA oFontEncabezado
   DATA oFontCelda

   METHOD new() CONSTRUCTOR
ENDCLASS
//------------------------------------------------------------------------------
METHOD new() CLASS TFuentes

   DEFINE FONT ::oFontEncabezado NAME "Tahoma" SIZE 0, - 16 bold
   DEFINE FONT ::oFontCelda NAME "Tahoma" SIZE 0, - 16

   RETURN ( Self )

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


pero si la llamo como ser desde mi clase que quiero utilizarla me dice que no la encuentra

Code: Select all | Expand

CLASS TApp FROM TFuentes
.....
endclass
....

with object ::oBrw
      WITH OBJECT :aCols[ 1 ]
         :cHeader       := "Id"
         :nWidth        := 80
         :nHeadStrAlign := AL_CENTER

         :oHeaderFont   := ::oFontEncabezado
         :oDataFont     := ::oFontCelda
      END WITH
 


cual es el problema? que la fuente no se muestra y si hago esto:

Code: Select all | Expand

fwdbg ::oFontEncabezado

no me devuelve nda. ni si quiera una referencia al afuente
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
TecniSoftware
Posts: 236
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: quiero definir fuentes que esten disponible en toda la app

Post by TecniSoftware »

Hola

Me parece que la clase TApp no debería definirse como FROM TFuentes

Yo haría asi:

Code: Select all | Expand


CLASS TApp

DATA oFuentes
.....
ENDCLASS

METHOD New() CLASS TApp

  ::oFuentes := TFuentes():New()
....


// Para el browse:

with object ::oBrw

      WITH OBJECT :aCols[ 1 ]

         :cHeader       := "Id"
         :nWidth        := 80
         :nHeadStrAlign := AL_CENTER

         :oHeaderFont   := ::oFuentes:oFontEncabezado
         :oDataFont       := ::oFuentes:oFontCelda

      END WITH

 



Saludos
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
karinha
Posts: 7941
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: quiero definir fuentes que esten disponible en toda la app

Post by karinha »

Code: Select all | Expand


#Include "FiveWin.Ch"

//----CLasse

CLASS TPublic

   METHOD New()  CONSTRUCTOR

ENDCLASS

METHOD New() CLASS TPublic

   Public TFecha, oFont, oFnt, oFont1, oFont2, oFont3

   TFecha := Date()

   DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -14 BOLD
   DEFINE FONT oFnt   NAME "Ms Sans Serif"  SIZE 00, -12 BOLD
   DEFINE FONT oFont1 NAME "Calibri"        SIZE 0,  -14
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0,  -18
   DEFINE FONT oFont3 NAME "Segoe UI"       SIZE 0,  -26

RETURN Self

//-------Seus PRGs - Para Pegar Variaveis publicas
// Datos := TPublic():New()

// ? TFecha
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: quiero definir fuentes que esten disponible en toda la app

Post by goosfancito »

TecniSoftware wrote:Hola

Me parece que la clase TApp no debería definirse como FROM TFuentes

Yo haría asi:

Code: Select all | Expand


CLASS TApp

DATA oFuentes
.....
ENDCLASS

METHOD New() CLASS TApp

  ::oFuentes := TFuentes():New()
....


// Para el browse:

with object ::oBrw

      WITH OBJECT :aCols[ 1 ]

         :cHeader       := "Id"
         :nWidth        := 80
         :nHeadStrAlign := AL_CENTER

         :oHeaderFont   := ::oFuentes:oFontEncabezado
         :oDataFont       := ::oFuentes:oFontCelda

      END WITH

 



Saludos


Consulto, pero al hacerl FROM... estoy heredando los metodos y datos de TFuentes... o no?
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: quiero definir fuentes que esten disponible en toda la app

Post by goosfancito »

karinha wrote:

Code: Select all | Expand


#Include "FiveWin.Ch"

//----CLasse

CLASS TPublic

   METHOD New()  CONSTRUCTOR

ENDCLASS

METHOD New() CLASS TPublic

   Public TFecha, oFont, oFnt, oFont1, oFont2, oFont3

   TFecha := Date()

   DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -14 BOLD
   DEFINE FONT oFnt   NAME "Ms Sans Serif"  SIZE 00, -12 BOLD
   DEFINE FONT oFont1 NAME "Calibri"        SIZE 0,  -14
   DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0,  -18
   DEFINE FONT oFont3 NAME "Segoe UI"       SIZE 0,  -26

RETURN Self

//-------Seus PRGs - Para Pegar Variaveis publicas
// Datos := TPublic():New()

// ? TFecha
 



Regards, saludos.


hola pero si defino como DATA en vez de "public" se estaria heredando tambien las data... o no es lo mismo que en "C"?
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
armando.lagunas
Posts: 346
Joined: Mon Oct 05, 2009 3:35 pm
Location: Curico-Chile
Contact:

Re: quiero definir fuentes que esten disponible en toda la app

Post by armando.lagunas »

Yo lo utilizo asi:

Code: Select all | Expand


class tapp

   DATA aWFont               INIT {}           //-- Array de Fonts
...
...
...
endclass
 


en tu programa inicial

Code: Select all | Expand


 #Include "FiveWin.Ch"
..
MEMVAR oApp

function main()

 oApp    := TApp()
..
..
 IniciarFonts()
..
..
..
AEval( oApp:aWFont, {|e| IIF(e!=Nil, e:End(), Nil )} )

return .t.

Function IniciarFonts()

 oApp:aWFont := ARRAY( 5 )

 DEFINE FONT   oApp:aWFont[1] NAME "Segoe WP"              SIZE 0, -17                 //  OK
 DEFINE FONT   oApp:aWFont[2] NAME "Segoe WP"              SIZE 0, -27                 //  OK
 DEFINE FONT   oApp:aWFont[3] NAME "Sagoe UI Light"        SIZE 0, -14                 //  OK
 DEFINE FONT   oApp:aWFont[4] NAME "Segoe UI Light"        SIZE 0, -32                 //  Titulos Gigantes en cualquier Dialogo
 DEFINE FONT   oApp:aWFont[5] NAME "Segoe UI Light"        SIZE 0, -20            //  OK

return nil
 


y en los programas individuales se utiliza como siempre

Code: Select all | Expand


...
...
                   REDEFINE SAY ID -16 OF oDlg PROMPT "N° Contrato"  FONT oApp:aWFont[3]
...
...
 


Saludos
SkyPe: armando.lagunas@hotmail.com
Mail: armando.lagunas@gmail.com
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: quiero definir fuentes que esten disponible en toda la app

Post by goosfancito »

Hola

Pude resolverlo de esta forma: no entiendo aun porque no se inicializan los objetos automaticamente...

Code: Select all | Expand

#Include "FiveWin.Ch"

CLASS TFuentes
   data oFont1
   data oFont2

   METHOD New()  CONSTRUCTOR

ENDCLASS

METHOD New() CLASS TFuentes

   DEFINE FONT ::oFont1  NAME "Ms Sans Serif"  SIZE 00, -14 BOLD
   DEFINE FONT ::oFont2  NAME "Ms Sans Serif"  SIZE 00, -14

RETURN  (Self)

------------------------------------------------

//despues del FROM la clase que primero tiene que ir es TFuentes, sino no funciona (no lo entiendo)

class TAPP FROM TFuentes, T....
    .....
   method new() constructor
   ...
end class

method new() class TApp
   ...
   ...
   ::Super:new()    // con esto inicializa TFuentes (no entiendo porque no fuiona si la primer clase despues del FROM no es TFuentes
   ...
return (self)

 
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Post Reply