Ir al contenido


Foto

Componente no actúa como debe en ejecución


  • Por favor identifícate para responder
No hay respuestas en este tema

#1 Desart

Desart

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 715 mensajes
  • LocationEspaña

Escrito 17 julio 2019 - 07:28

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
  1. unit U_L_DBNavigator1;
  2.  
  3. {$mode delphi}
  4.  
  5. interface
  6.  
  7. uses
  8. Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, DBCtrls, Buttons;
  9.  
  10. type
  11.  
  12. { U_L_DBNavigator1 }
  13.  
  14. { TL_DBNavigator1 }
  15.  
  16. TL_DBNavigator1 = class(TDBNavigator)
  17. private
  18. FColorFont: Tcolor;
  19. FLayout: TButtonLayout;
  20. FSizeFontText: Integer;
  21. FUserText: Boolean;
  22. procedure SetColorFont(AValue: Tcolor);
  23. procedure setlayout(AValue: TButtonLayout);
  24. procedure SetSizeFontText(AValue: Integer);
  25. procedure SetUserText(AValue: Boolean);
  26.  
  27. protected
  28.  
  29. public
  30. constructor Create(AOwner: TComponent); override;
  31. procedure Repaint; override;
  32. published
  33. property UserText :Boolean read FUserText write SetUserText; //Ver nombre en los botones AQUI PONER EL DEFAULT si es necesario
  34. property SizeFontText :Integer read FSizeFontText write SetSizeFontText; //tamaño de la fuente del texto AQUI PONER EL DEFAULT si es necesario
  35. property Layout :TButtonLayout read Flayout write setlayout;
  36. property ColorFont :Tcolor read FColorFont write SetColorFont;
  37. end;
  38.  
  39. procedure Register;
  40.  
  41. implementation
  42.  
  43. procedure Register;
  44. begin
  45. {$I u_l_dbnavigator1_icon.lrs}
  46. RegisterComponents('AA_MIOS',[TL_DBNavigator1]);
  47.  
  48. { U_L_DBNavigator1 }
  49.  
  50. procedure TL_DBNavigator1.SetSizeFontText(AValue: Integer);
  51. //------------------------------------------------------------------------------
  52. //**********************************************************[ SIZEFONTTEXT ]****
  53. // tamaño de la fuente del texto
  54. //------------------------------------------------------------------------------
  55. begin
  56. if FSizeFontText<>Avalue then FSizeFontText:=AValue;
  57. setUserText(FUserText);
  58.  
  59. procedure TL_DBNavigator1.setlayout(AValue: TButtonLayout);
  60. begin
  61. if Flayout=AValue then Exit;
  62. Flayout:=AValue;
  63. setUserText(FUserText);
  64.  
  65. procedure TL_DBNavigator1.SetColorFont(AValue: Tcolor);
  66. begin
  67. if FColorFont=AValue then Exit;
  68. FColorFont:=AValue;
  69. SetUserText(FUserText);
  70.  
  71. procedure TL_DBNavigator1.SetUserText(AValue: Boolean);
  72. //------------------------------------------------------------------------------
  73. //**************************************************************[ USERTEXT ]****
  74. // Ver nombre en los botones
  75. //------------------------------------------------------------------------------
  76. var
  77. B: TNavigateBtn;
  78. begin
  79. if FUserText<>Avalue then FUserText:=AValue;
  80. if FUserText=true then
  81. begin
  82. for B := Low ( TNavigateBtn ) to High ( TNavigateBtn ) do
  83. begin
  84. with TL_DBNavigator1( Self ).Buttons [ B ] do
  85. begin
  86. Case Index of
  87. nbFirst : Caption := 'Primero';
  88. nbPrior : Caption := 'Anterior';
  89. nbNext : Caption := 'Siguiente';
  90. nbLast : Caption := 'Último';
  91. nbInsert : Caption := 'Insertar';
  92. nbDelete : Caption := 'Borrar';
  93. nbEdit : Caption := 'Editar';
  94. nbPost : Caption := 'Grabar';
  95. nbCancel : Caption := 'Cancelar';
  96. nbRefresh : Caption := 'Refrescar';
  97. End;
  98. Case Index of
  99. nbFirst : Hint := 'Ir al primer registro';
  100. nbPrior : hint := 'Ir al registro anterior';
  101. nbNext : hint := 'Ir al siguiente registro';
  102. nbLast : hint := 'Ir al último registro';
  103. nbInsert : hint := 'Insertar un nuevo registro';
  104. nbDelete : hint := 'Borrar el registro actual';
  105. nbEdit : hint := 'Editar el registro actual';
  106. nbPost : hint := 'Grabar el registro actual';
  107. nbCancel : hint := 'Cancelar la edición del registro actual';
  108. nbRefresh : hint := 'Refrescar los datos';
  109. End;
  110.  
  111. Buttons[B].Layout:=Flayout; //posición del icono
  112. Buttons[B].Font.Color:=FColorFont; //Damos color a la fuente
  113. Buttons[B].Font.Size:=FSizeFontText; //tamaño que le damos a la fuente
  114. Buttons[B].Hint := Caption; // asignamos al hint el valor del literal del caption
  115. Buttons[B].ShowHint := True;
  116. end;
  117. end;
  118. end else
  119. begin
  120. for B := Low ( TNavigateBtn ) to High ( TNavigateBtn ) do
  121. begin
  122. with TL_DBNavigator1 ( Self ).Buttons [ B ] do
  123. begin
  124. Case Index of
  125. nbFirst : Caption := '';
  126. nbPrior : Caption := '';
  127. nbNext : Caption := '';
  128. nbLast : Caption := '';
  129. nbInsert : Caption := '';
  130. nbDelete : Caption := '';
  131. nbEdit : Caption := '';
  132. nbPost : Caption := '';
  133. nbCancel : Caption := '';
  134. nbRefresh : Caption := '';
  135. End;
  136. Buttons[B].Layout := Flayout; //posición del icono
  137. Buttons[B].Font.Color:=FColorFont; //Damos color a la fuente
  138. Buttons[B].Font.Size:=FSizeFontText; //tamaño que le damos a la fuente
  139. Buttons[B].Hint := Caption; // asignamos al hint el valor del literal del caption
  140. Buttons[B].ShowHint := True;
  141. end;
  142. end;
  143. end;
  144. Repaint;
  145.  
  146. {begin
  147. if FUserText=AValue then Exit;
  148. FUserText:=AValue;
  149. end;} //Original
  150.  
  151. constructor TL_DBNavigator1.Create(AOwner: TComponent);
  152. begin
  153. inherited Create(AOwner);
  154. FUserText := False ; //Ver nombre en los botones
  155. FSizeFontText := 6; //tamaño de la fuente del texto
  156. VisibleButtons:= [nbFirst,nbPrior,nbNext,nbLast]; //Botones visibles de entrada
  157. Flayout:=blGlyphTop;
  158. setUserText(FUserText);
  159.  
  160. procedure TL_DBNavigator1.Repaint;
  161. begin
  162. inherited Repaint;
  163.  


Editado por Desart, 17 julio 2019 - 07:30 .

  • 0




IP.Board spam blocked by CleanTalk.