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
AUNQUE PONGA PHP, ES UN ARCHIVO PAS
php
unit U_L_DBNavigator1; {$mode delphi} interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DBCtrls, Buttons; type { U_L_DBNavigator1 } { TL_DBNavigator1 } 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; //Ver nombre en los botones AQUI PONER EL DEFAULT si es necesario property SizeFontText :Integer read FSizeFontText write SetSizeFontText; //tamaño de la fuente del texto AQUI PONER EL DEFAULT si es necesario 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; { U_L_DBNavigator1 } procedure TL_DBNavigator1.SetSizeFontText(AValue: Integer); //------------------------------------------------------------------------------ //**********************************************************[ SIZEFONTTEXT ]**** // tamaño de la fuente del texto //------------------------------------------------------------------------------ begin if FSizeFontText<>Avalue then FSizeFontText:=AValue; setUserText(FUserText); end; procedure TL_DBNavigator1.setlayout(AValue: TButtonLayout); begin Flayout:=AValue; setUserText(FUserText); end; procedure TL_DBNavigator1.SetColorFont(AValue: Tcolor); begin FColorFont:=AValue; SetUserText(FUserText); end; procedure TL_DBNavigator1.SetUserText(AValue: Boolean); //------------------------------------------------------------------------------ //**************************************************************[ USERTEXT ]**** // Ver nombre en los botones //------------------------------------------------------------------------------ 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; //posición del icono Buttons[B].Font.Color:=FColorFont; //Damos color a la fuente Buttons[B].Font.Size:=FSizeFontText; //tamaño que le damos a la fuente Buttons[B].Hint := Caption; // asignamos al hint el valor del literal del 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; //posición del icono Buttons[B].Font.Color:=FColorFont; //Damos color a la fuente Buttons[B].Font.Size:=FSizeFontText; //tamaño que le damos a la fuente Buttons[B].Hint := Caption; // asignamos al hint el valor del literal del caption Buttons[B].ShowHint := True; end; end; end; Repaint; End; {begin FUserText:=AValue; constructor TL_DBNavigator1.Create(AOwner: TComponent); begin inherited Create(AOwner); FUserText := False ; //Ver nombre en los botones FSizeFontText := 6; //tamaño de la fuente del texto VisibleButtons:= [nbFirst,nbPrior,nbNext,nbLast]; //Botones visibles de entrada Flayout:=blGlyphTop; setUserText(FUserText); end; procedure TL_DBNavigator1.Repaint; begin inherited Repaint; end; end.
Editado por Desart, 17 julio 2019 - 07:30 .