Buenas tardes, compañero, un placer comunicarme con vosotros otra vez después de tanto tiempo.
Resulta que he empezado a trabajar con Lazarus y estoy comenzando a pasar mis componentes delphi a Lazarus.
Este es el primero que paso, funciona bien en modo de diseño, pero al ejecutar el texto me desaparece. He estado buscando la información pero no la encuentro, a ver si podéis ayudar, gracias como siempre por adelantado
Los problemas son:
No aparece el caption de cada botón
El hint que muestra es en ingles
Código Delphi
[-]
unit U_L_DBNavigator1;
{$mode delphi}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DBCtrls, Buttons;
type
TL_DBNavigator1 = class(TDBNavigator)
private
FColorFont: Tcolor;
FLayout: TButtonLayout;
FSizeFontText: Integer;
FUserText: Boolean;
procedure SetColorFont(AValue: Tcolor);
procedure setlayout(AValue: TButtonLayout);
procedure SetSizeFontText(AValue: Integer);
procedure SetUserText(AValue: Boolean);
protected
public
constructor Create(AOwner: TComponent); override;
procedure Repaint; override;
published
property UserText :Boolean read FUserText write SetUserText; property SizeFontText :Integer read FSizeFontText write SetSizeFontText; property Layout :TButtonLayout read Flayout write setlayout;
property ColorFont :Tcolor read FColorFont write SetColorFont;
end;
procedure Register;
implementation
procedure Register;
begin
{$I u_l_dbnavigator1_icon.lrs}
RegisterComponents('AA_MIOS',[TL_DBNavigator1]);
end;
procedure TL_DBNavigator1.SetSizeFontText(AValue: Integer);
begin
if FSizeFontText<>Avalue then FSizeFontText:=AValue;
setUserText(FUserText);
end;
procedure TL_DBNavigator1.setlayout(AValue: TButtonLayout);
begin
if Flayout=AValue then Exit;
Flayout:=AValue;
setUserText(FUserText);
end;
procedure TL_DBNavigator1.SetColorFont(AValue: Tcolor);
begin
if FColorFont=AValue then Exit;
FColorFont:=AValue;
SetUserText(FUserText);
end;
procedure TL_DBNavigator1.SetUserText(AValue: Boolean);
var
B: TNavigateBtn;
begin
if FUserText<>Avalue then FUserText:=AValue;
if FUserText=true then
begin
for B := Low ( TNavigateBtn ) to High ( TNavigateBtn ) do
begin
with TL_DBNavigator1( Self ).Buttons [ B ] do
begin
Case Index of
nbFirst : Caption := 'Primero';
nbPrior : Caption := 'Anterior';
nbNext : Caption := 'Siguiente';
nbLast : Caption := 'Último';
nbInsert : Caption := 'Insertar';
nbDelete : Caption := 'Borrar';
nbEdit : Caption := 'Editar';
nbPost : Caption := 'Grabar';
nbCancel : Caption := 'Cancelar';
nbRefresh : Caption := 'Refrescar';
End;
Case Index of
nbFirst : Hint := 'Ir al primer registro';
nbPrior : hint := 'Ir al registro anterior';
nbNext : hint := 'Ir al siguiente registro';
nbLast : hint := 'Ir al último registro';
nbInsert : hint := 'Insertar un nuevo registro';
nbDelete : hint := 'Borrar el registro actual';
nbEdit : hint := 'Editar el registro actual';
nbPost : hint := 'Grabar el registro actual';
nbCancel : hint := 'Cancelar la edición del registro actual';
nbRefresh : hint := 'Refrescar los datos';
End;
Buttons[b].Layout:=Flayout; Buttons[b].Font.Color:=FColorFont; Buttons[b].Font.Size:=FSizeFontText; Buttons[b].Hint := Caption; Buttons[b].ShowHint := True;
end;
end;
end else
begin
for B := Low ( TNavigateBtn ) to High ( TNavigateBtn ) do
begin
with TL_DBNavigator1 ( Self ).Buttons [ B ] do
begin
Case Index of
nbFirst : Caption := '';
nbPrior : Caption := '';
nbNext : Caption := '';
nbLast : Caption := '';
nbInsert : Caption := '';
nbDelete : Caption := '';
nbEdit : Caption := '';
nbPost : Caption := '';
nbCancel : Caption := '';
nbRefresh : Caption := '';
End;
Buttons[b].Layout := Flayout; Buttons[b].Font.Color:=FColorFont; Buttons[b].Font.Size:=FSizeFontText; Buttons[b].Hint := Caption; Buttons[b].ShowHint := True;
end;
end;
end;
Repaint;
End;
constructor TL_DBNavigator1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FUserText := False ; FSizeFontText := 6; VisibleButtons:= [nbFirst,nbPrior,nbNext,nbLast]; Flayout:=blGlyphTop;
setUserText(FUserText);
end;
procedure TL_DBNavigator1.Repaint;
begin
inherited Repaint;
end;
end.