Cordial saludo,
Trabajo con Firebird, Delphi XE7 y FIBPlus, y estoy guardando en un campo de tipo BLOB SUB_TYPE 1 un texto escrito en un DBRichEdit, este me lo guarda perfectamente lo que corresponde a tamaño de fuente, tipo de fuente y color (Me desconecto y vuelvo a conectar), pero no conserva la alineacion (centrado o derecha), siempre la da taLeftJustify.
Que hay que hacer para que guarde esa propiedad que desee el usuario? Adjunto el codigo.
Código Delphi
[-]
type
TwMain = class(TForm)
DBNavigator1: TDBNavigator;
Edicion: TDBRichEdit;
Panel1: TPanel;
BSubrayado: TPngSpeedButton;
BCursiva: TPngSpeedButton;
BTachada: TPngSpeedButton;
BIzquierda: TPngSpeedButton;
BCentrado: TPngSpeedButton;
BDerecha: TPngSpeedButton;
BBolo: TPngSpeedButton;
CBFuentes: TComboBox;
EdTamano: TEdit;
pFIBDatabase1: TpFIBDatabase;
pFIBTransaction1: TpFIBTransaction;
pFIBDataSet1: TpFIBDataSet;
DataSource1: TDataSource;
PopupMenu1: TPopupMenu;
Color1: TMenuItem;
Fuente1: TMenuItem;
DColor: TColorDialog;
DFuente: TFontDialog;
BNegrita: TSpeedButton;
procedure Color1Click(Sender: TObject);
procedure Fuente1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BNegritaClick(Sender: TObject);
procedure BSubrayadoClick(Sender: TObject);
procedure BCursivaClick(Sender: TObject);
procedure BTachadaClick(Sender: TObject);
procedure EdTamanoKeyPress(Sender: TObject; var Key: Char);
procedure BIzquierdaClick(Sender: TObject);
procedure BCentradoClick(Sender: TObject);
procedure BDerechaClick(Sender: TObject);
procedure CBFuentesClick(Sender: TObject);
procedure BBoloClick(Sender: TObject);
procedure EdicionSelectionChange(Sender: TObject);
private
procedure BotonEstilo(Sender: TObject);
procedure BotonAlinear(Sender:TObject);
public
end;
var
wMain: TwMain;
implementation
{$R *.dfm}
procedure TwMain.BBoloClick(Sender: TObject);
begin
IF BBolo.Down THEN
Edicion.Paragraph.Numbering := nsBullet
ELSE Edicion.Paragraph.Numbering := nsNone;
end;
procedure TwMain.BCentradoClick(Sender: TObject);
begin
BotonAlinear(BCentrado);
end;
procedure TwMain.BCursivaClick(Sender: TObject);
begin
BotonEstilo(BCursiva);
end;
procedure TwMain.BDerechaClick(Sender: TObject);
begin
BotonAlinear(BDerecha);
end;
procedure TwMain.BIzquierdaClick(Sender: TObject);
begin
BotonAlinear(BIzquierda);
end;
procedure TwMain.BNegritaClick(Sender: TObject);
begin
BotonEstilo(BNegrita);
end;
procedure TwMain.BotonAlinear(Sender: TObject);
begin
WITH Sender AS TSpeedButton DO
Edicion.Paragraph.Alignment := TAlignment(Tag);
end;
procedure TwMain.BotonEstilo(Sender: TObject);
begin
WITH (Sender AS TSpeedButton), Edicion.SelAttributes DO
BEGIN
IF Down THEN
Style := Style + [TFontStyle(Tag)]
ELSE
Style := Style - [TFontStyle(Tag)];
END;
end;
procedure TwMain.BSubrayadoClick(Sender: TObject);
begin
BotonEstilo(BSubrayado);
end;
procedure TwMain.BTachadaClick(Sender: TObject);
begin
BotonEstilo(BTachada);
end;
procedure TwMain.CBFuentesClick(Sender: TObject);
begin
Edicion.SelAttributes.Name := CBFuentes.Text;
Edicion.SetFocus;
end;
procedure TwMain.Color1Click(Sender: TObject);
begin
DColor.Color := Edicion.SelAttributes.Color;
IF DColor.Execute THEN
Edicion.SelAttributes.Color := DColor.Color;
end;
procedure TwMain.EdicionSelectionChange(Sender: TObject);
var
N: SmallInt;
begin
WITH Edicion.SelAttributes, Edicion.Paragraph DO
BEGIN
FOR N:=0 TO CBFuentes.Items.Count-1 DO
IF CBFuentes.Items[N] = Edicion.SelAttributes.Name THEN
CBFuentes.ItemIndex := N;
EdTamano.Text := InttoStr(Size);
BNegrita.Down := fsBold IN Style;
BSubrayado.Down := fsUnderline IN Style;
BCursiva.Down := fsItalic IN Style;
BTachada.Down := fsStrikeOut IN Style;
BBolo.Down := Numbering = nsBullet;
BIzquierda.Down := Alignment = taLeftJustify;
BCentrado.Down := Alignment = taCenter;
BDerecha.Down := Alignment = taRightJustify;
END;
end;
procedure TwMain.EdTamanoKeyPress(Sender: TObject; var Key: Char);
begin
IF Key = #13 THEN
BEGIN
Edicion.SelAttributes.Size := StrToInt(EdTamano.Text);
Key := #0;
Edicion.SetFocus;
END
ELSE
IF ( (Key < '0') OR (Key > '9') ) AND (Key <> #8) THEN
Key := #0;
end;
procedure TwMain.FormCreate(Sender: TObject);
begin
CBFuentes.Items := Screen.Fonts;
BNegrita.Tag := longint(fsBold);
BSubrayado.Tag := longint(fsUnderline);
BCursiva.Tag := longint(fsItalic);
BTachada.Tag := longint(fsStrikeOut);
BIzquierda.Tag := longint(taLeftJustify);
BCentrado.Tag := longint(taCenter);
BDerecha.Tag := longint(taRightJustify);
pFIBDatabase1.Connected := True;
pFIBDataSet1.Transaction.StartTransaction;
pFIBDataSet1.Open;
end;
procedure TwMain.FormShow(Sender: TObject);
begin
BotonAlinear(BIzquierda);
BIzquierda.Down := True;
CBFuentes.Text := Edicion.SelAttributes.Name;
Edicion.SetFocus;
end;
procedure TwMain.Fuente1Click(Sender: TObject);
begin
DFuente.Font.Name := Edicion.SelAttributes.Name;
IF DFuente.Execute THEN
BEGIN
Edicion.SelAttributes.Name := DFuente.Font.Name;
Edicion.SelAttributes.Color := DFuente.Font.Color;
Edicion.SelAttributes.Size := DFuente.Font.Size;
END;
end;
end.
Gracias de antemano.