Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > OOP
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Coloboración Paypal con ClubDelphi

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21/02/2012
Jose Roman Jose Roman is offline
Miembro
 
Join Date: Jul 2006
Location: Colombia
Posts: 364
Poder: 21
Jose Roman Va por buen camino
Archivo INI y propiedad FontStyle

Hola a todos, resulta que estoy creando un reporte con QuickReport con algunas cosas en tiempo de ejecución, mi duda es la siguiente:

Creo un QRLabel y en el archivo INI deseo asignarle la propiedad fsBold pero me da error al leer la fila, esto lo deseo hacer pero sin llegar hacer un condicional IF. Este es la linea:
Código Delphi [-]
qrLabel.Font.Style    := ReadString('TITU','Style','');

Gracias de antemano por la ayuda brindada.
Reply With Quote
  #2  
Old 21/02/2012
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Abría que ver:
1- Como llamas al archivo INI desde el principio.
2- Como creas el qreport.
3- En que linea del INI esta el style del qrlabel.
Saludos
__________________
Siempre Novato
Reply With Quote
  #3  
Old 21/02/2012
Jose Roman Jose Roman is offline
Miembro
 
Join Date: Jul 2006
Location: Colombia
Posts: 364
Poder: 21
Jose Roman Va por buen camino
Gracias por responder:
- El archivo INI se llama de igual manera que el ejecutable
- Ya tengo un reporte de la clase TQuickRep creado, solo que esta en blanco para que este se llene con lo necesario en el archivo INI
- La linea del archivo INI es :
[TITU]
Top=0
Left=56
Height=23
Width=311
Font=BankGothic Md BT
Style=fsBold
Size=14

Todo me lo crea y enseña el reporte con la configuración del INI solo con Style tengo el inconveniente.

Last edited by Jose Roman : 21/02/2012 at 22:40.
Reply With Quote
  #4  
Old 21/02/2012
Casimiro Noteví's Avatar
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Join Date: Sep 2004
Location: En algún lugar.
Posts: 32,682
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
¿Y fsBold es un valor correcto para Style?
¿Puede tener otros valores 'sumados'?

Se me adelantó Román, era eso a donde quería llegar.
Reply With Quote
  #5  
Old 21/02/2012
Delphius's Avatar
[Delphius] Delphius is offline
Miembro Premium
 
Join Date: Jul 2004
Location: Salta, Argentina
Posts: 5,582
Poder: 28
Delphius Va camino a la fama
Muy posiblemente el error está en que la propiedad Style es de un tipo diferente a un string

Y por tanto cuando intentas leer el dato como string, y pasarlo a una propiedad de un tipo diferente, ¡pum! aparece salvaje error
Necesitas implementar de algún modo, una asociación entre el tipo que espera y lo guardado en el ini. No hay otra...

Saludos,
__________________
Delphius
[Guia de estilo][Buscar]
Reply With Quote
  #6  
Old 21/02/2012
roman's Avatar
roman roman is offline
Moderador
 
Join Date: May 2003
Location: Ciudad de México
Posts: 20,269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
La propiedad Style es un conjunto, no un valor suelto. En lugar de guardar Style como una propiedad, podrías guardar cada uno de los posibles elementos, por ejemplo:

Code:
[TITU]
Bold=true
Italic=false
Entonces, para leer los valores, harías algo así:

Código Delphi [-]
Valor := ReadBool('TITU','Bold',false);
if Valor
  then qrLabel.Font.Style := qrLabel.Font.Style + [fsBold]
  else qrLabel.Font.Style := qrLabel.Font.Style - [fsBold];

// Saludos
Reply With Quote
  #7  
Old 21/02/2012
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
Cuando se meten los Maestros y con tan buenas respuestas, mejor, calladito Caral.
Saludos
__________________
Siempre Novato
Reply With Quote
  #8  
Old 21/02/2012
ecfisa's Avatar
ecfisa ecfisa is offline
Moderador
 
Join Date: Dec 2005
Location: Tres Arroyos, Argentina
Posts: 10,508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Jose.

Como te comentó roman, la propiedad Style es un set, otra forma que se me ocurre podés lograrlo es:
Código Delphi [-]
procedure TForm.FormCreate(Sender: TObject);
begin
  with TIniFile.Create('C:\TEMP\ARCHIVO.INI') do
  try
    ...
    Label1.Font.Style:= TFontStyles(Byte(ReadInteger('LABEL1','STYLE',0)));
  finally
    Free;
  end;
end;
...
procedure TForm.FormDestroy(Sender: TObject);
begin
  with TIniFile.Create('C:\TEMP\ARCHIVO.INI') do
  try
    ...
    WriteInteger('LABEL1','STYLE',Byte(Label1.Font.Style));
  finally
    Free;
  end;
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Reply With Quote
  #9  
Old 22/02/2012
roman's Avatar
roman roman is offline
Moderador
 
Join Date: May 2003
Location: Ciudad de México
Posts: 20,269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Y nótese que estamos aplicando a rajatabla la regla 3 de la otra guía de estilo.

// Saludos
Reply With Quote
  #10  
Old 22/02/2012
Casimiro Noteví's Avatar
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Join Date: Sep 2004
Location: En algún lugar.
Posts: 32,682
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Seguramente te han regalado esta navidad una nueva bola de cristal USB
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
propiedad del dblookupcombobox Vales08 Varios 1 24/06/2011 23:37
no puedo abrir un archivo con ShellExecute si el archivo es variable belpab API de Windows 2 28/11/2007 16:24
Propiedad del DBGrid Iskariote0087 Varios 3 19/01/2006 15:53
Propiedad KeyValue i.larranaga Conexión con bases de datos 0 01/10/2004 14:18
como le coloco la propiedad a un tsession desde un archivo txt perico OOP 4 28/11/2003 15:22


All times are GMT +2. The time now is 14:03.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi