Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > Lazarus, FreePascal, Kylix, etc.
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 20-07-2019
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
Componente no actúa como debe en ejecución

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
 
  { 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
  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);
//------------------------------------------------------------------------------
//**************************************************************[ 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
  if FUserText=AValue then Exit;
  FUserText:=AValue;
end;}   //Original
 
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.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #2  
Antiguo 20-07-2019
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.021
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
¿No estarás usando uno anterior al nuevo editado?
Responder Con Cita
  #3  
Antiguo 20-07-2019
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 22
José Luis Garcí Va camino a la fama
No lo he editado, siguiendo el código del anterior en delphi, pero partiendo desde 0 en Lazarus.

El tema es que en fase de diseño, muestra el texto, pero en cuanto lo ejecuto desaparece.

Ahora si cojo la parte del código y lo pongo en el oncreate del Form, funciona bien, por lo que no tengo mayor problema, pero no entiendo cual es el problema a la hora de ejecutarlo.

Como siempre gracias.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Menú desplegable al posicionar el mouse en una imagen que actúa como botón socosa Varios 2 15-11-2014 23:24:46
El round no funciona como debe ser ? IVAND SQL 1 30-07-2007 21:21:13
Como se debe programar... sierraja Varios 4 13-09-2005 16:39:30
¿Como saber cuabdo un componente esta invisible en tiempo de ejecuciòn? danytorres Varios 1 20-05-2003 16:51:21


La franja horaria es GMT +2. Ahora son las 22:38:56.


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