Jump to content

Caption to the buttons of dbnavigator


rencarnacion

Recommended Posts

HI Ronny Encarnacion.

 

Try:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[0].setTooltip("First")');
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[1].setTooltip("Prev")');
end;

Best regards

Link to comment
Share on other sites

Hi, 
 
i think that the solution of Mr.  Delphi Developer is  fantastic : i can use it to easily change the icons of uniDBNavigator. 
                 
                            UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[5].icon = ''files/delete.png'';') ;
 
   
I want to give another solution anyway. 
 
1) Set  ShowHint  to true of unidbnavigator properties,  you get  automatically the hints (Messages) of normal dbvavigator-delphi messages
 (First record,Next Record, ...)    
 
 
 
 
2) if you want to translate any standart Delphi messages , you can use the following code in the servermodule.pas.
 
 
<<===============================================================================>>
 
unit ServerModule;
 
interface
 
uses
  SysUtils, uniGUIServer, uniGUIMainModule, uniGUIApplication,VdbConsts,windows,consts;
 
type
  TUniServerModule = class(TUniGUIServerModule)
    procedure UniGUIServerModuleCreate(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure FirstInit; override;
  public
    { Public declarations }
 
  end;
 
function UniServerModule: TUniServerModule;
 
implementation
 
{$R *.dfm}
 
uses
  UniGUIVars;
 
function UniServerModule: TUniServerModule;
begin
  Result:=TUniServerModule(UniGUIServerInstance);
end;
 
 
 
// Add  Procedure    <<<========================================
 
procedure HookResourceString(rs: PResStringRec; newStr: PChar);
var
  oldprotect: DWORD;
begin
  VirtualProtect(rs, SizeOf(rs^), PAGE_EXECUTE_READWRITE, @oldProtect);
  rs^.Identifier := Integer(newStr);
  VirtualProtect(rs, SizeOf(rs^), oldProtect, @oldProtect);
end;
 
 
// ============================================================== 
 
 
procedure TUniServerModule.FirstInit;
begin
  InitServerModule(Self);
end;
 
 
 
 
initialization
  RegisterServerModuleClass(TUniServerModule);
 
  //translate  messages in  VdbConsts.pas Unit  ( English to  Italian) 
 
  HookResourceString(@SFirstRecord,pchar('Primo'));
  HookResourceString(@SPriorRecord,pchar('Precedente'));
  HookResourceString(@SNextRecord,pchar('Successivo'));
  HookResourceString(@SLastRecord,pchar('Ultimo'));
  HookResourceString(@SInsertRecord,pchar('Nuovo'));
  HookResourceString(@SDeleteRecord,pchar('Cancella'));
  HookResourceString(@SCancelEdit,pchar('Cancella Modifiche'));
  HookResourceString(@SEditRecord,pchar('Modifica'));
  HookResourceString(@SPostEdit,pchar('Conferma Modifiche'));
 
 // translate  messages in  Consts.pas  Unit  ( English to  Italian) 
 
  HookResourceString(@SMsgDlgWarning,pchar('Attenzione')) ;
  HookResourceString(@SMsgDlgInformation,pchar('Informazione')) ;
  HookResourceString(@SMsgDlgConfirm,pchar('Conferma')) ;
  HookResourceString(@SMsgDlgError,pchar('Errore')) ;
 
end.

 

 

P.s . Tested only with Delphi XE2 + Delphi XE3 

 

 

Best Regards

Link to comment
Share on other sites

  • 5 years later...
On 5/16/2014 at 10:47 PM, Sherzod said:

HI Ronny Encarnacion.

 

Try:


procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[0].setTooltip("First")');
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[1].setTooltip("Prev")');
end;

Best regards

А как узнать,  какой индекс у какой кнопки навигатора? Ведь кнопку в будущем можно скрыть и забыть о том, что где-то есть отдельная процедура для подписей.

Не правильно ли сделать какой-то свойство в Диспетчере свойств?

Можно было бы общую процедуру сделать

procedure SetDBNavCapt(UniDBNavigator: TUniDBNavigator);
begin
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[0].setTooltip("First")');
  UniSession.AddJS(UniDBNavigator1.JSName +  '.items.items[1].setTooltip("Prev")');
...
  ....

Но у разных навигаторов на разных формах могут быть показаны/скрыты разные кнопки.

Link to comment
Share on other sites

15 minutes ago, x11 said:

Но у разных навигаторов на разных формах могут быть показаны/скрыты разные кнопки.

UniDBNavigator.VisibleButtons = ?

Link to comment
Share on other sites

×
×
  • Create New...