Jump to content

New Tuniedit with new properties: fieldLabel, labelAlign, labelWidth, minLength, minLengthTex, TriggersButton.


rullomare

Recommended Posts

Hi, 

 

New Tuniedit with new properties: fieldLabel, labelAlign, labelWidth,  minLength, minLengthTex, TriggersButton.

 

 

Using this component create alignment problems(if use fieldLabel) with the other components  between Design Time and Run Time.

 

For the rest seems to work properly.

 

The alignment between the various components must be calibrated manually.

 

I wrote it for long time ago, but i not posted it  for the problem described above. 

 

post-1298-0-72579400-1424686135_thumb.jpg

 

post-1298-0-56122100-1424686163_thumb.jpg

 

 

 NewEditButon.zip            modified 25/02/2015 

 

 

Installation:

 

 

1) change your Delphi version.

 

package BMUniTriggersButtonEdit;

 

 

 

requires

  rtl,

  vcl,

  UniGUI18;   // XE4 , change your delphi version.  

             

              // XE2  UniGUI16;

              // XE3  UniGUI17; 

              // XE4  UniGUI18; 

              // XE5  UniGUI19; 

              // XE6  UniGUI20; 

              // XE7  UniGUI21; 

 

   

 

contains

  BmUniTriggersButtonEdit in 'BMUniTriggersButtonEdit.pas';

 

 

end.

 

 

 

2) Build and Install package.

 

 

 

3) compile and Run  Triggersdemo.dpr

 

 

Enjoy!

 

 

 

Salvatore Marullo.

  • Upvote 2
Link to comment
Share on other sites

 

 
 
Installation:
 
 
1) change your Delphi version.
 
package BMUniTriggersButtonEdit;
 
 
 
 
4) compile and Run  Triggersdemo.dpr Enjoy!  Salvatore Marullo.
 
Hi mister Marullo, 
 
 
I tried to add this component internally call a form , but failed to add the form to use , generate compilation error , known way to do it?

thx

 

 

Link to comment
Share on other sites

Hi Salvatore

I wanted to add functionality to this component which allows to call a form , which was a variable Ideally , you could support me to achieve this purpose ?
Would serve to it was used in data searches in which you could use a single form for all inquiries.
Thanks attention to this request , excuse the English , but write with google translator

-----

He querido adicionar una funcionalidad a este componente el cual permita llamar una forma, la cual seria ideal fuera una variable, podrias darme soporte para lograr este proposito? 
Serviria para que se usara en busquedas de datos en el cual se pudiera usar una forma unica para todas las consultas.
gracias la atencion a la presente solicitud, disculpa el ingles,  pero  escribo con  traductor  de google
Link to comment
Share on other sites

Hi Salvatore,

 

(if I understood) logisticasoft wants to make a new functionality to the component, which would creating a new form at runtime (using the trigger event I guess).

 

He is requesting your help.

 

Tonight I will try something (if Elizabeth wants :D). I´m not sure.

 

Best regards my friend

Link to comment
Share on other sites

Hi Salvatore,

 

(if I understood) logisticasoft wants to make a new functionality to the component, which would creating a new form at runtime (using the trigger event I guess).

 

He is requesting your help.

 

Tonight I will try something (if Elizabeth wants :D). I´m not sure.

 

Best regards my friend

 

Hi, thanks for your support
Is it correct their interpretation, the idea is that this component has some additional attributes (Table On request, Campos to Deploy, conditions) and can call another form (Seria Fabulous that a variable is used), when you fire the the trigger even.
This way I only use a standard form would require to perform all basic tables and queries to update the value of the contents of the edit
 
In delphi use this component, is functional, require improvements but as an example could help

*********

unit MUEDIT;
{MODIFICACIONES
 20010101 -- INCIAL
 20130630 -- SE AGREGA ATRIBUTO PGMCONSULTA PARA MANEJAR CONSULTA ESPECIALIZADA EN PANTALLAS MAS PEQUENAS
 20140927 -- SE AGREGA PGMASOCIADO
}
 
interface
 
uses
   WINDOWS, Messages, SysUtils, Classes, Controls ,
  Dialogs,StdCtrls,Graphics,forms,dbclient,Provider
  ,Db, SDCommon, SDEngine ;
 
 
type
  TMUEDIT = class(TEDIT)
  private
    Fvalide        :boolean;
    FAceptaNulos   :boolean;
    FUseUSRDFT     :boolean;  //20130308
    FExisteMst     :boolean;
    Ftexto         :string;
    FField         :string;
    FfieldsShow    :string;
    FOrderBy       :string;     // ORDENADO POR 20080515
    Fvalor         :string;
    Finteger       :integer;   //20121204
    FFloat         :Double;    //20121204
    FDate          :TDate;     //20121204
    Ftime          :TTime;     //20121204
    FString        :String;
    Ftable         :string;    // TABLA QUE SE USA PARA VALIDAR LOS DATOS
    Fkey1          :string;
    Fkey2          :string;
    FWHERE         :string;
    FGET_DEFAULT   :string;       // 20110415
    FPGM_VALIDACION:string;       // 20111206
    FPGM_VALIDACIONOK:Boolean ;   // 20131022
 
    Fmensaje       :string;
    Fnumerico      :Boolean ;   // SI EL CAMPO ES NUMERICO PERMITE SOLO VALORES NUMERICOS
    Fdecimales     :Integer;
    FtituloConsulta:string;
    FPGMCONSULTA   :string;      // 20130630
    FPGMASOCIADO  :string;        //20140924
 
 
    W_SQL          :string;
    FDATASET       : TDATASET;
    FQuery1          :TSDQuery;
    FClientDataSet1  :TClientDataSet;
    FDataSetProvider1:TDataSetProvider;
    procedure armar_sql;
  protected
    procedure  doenter; override;
    procedure  DOExit ; override;
    procedure  DblClick ; override;
    procedure  Click ; override;
    procedure  consulte;
    procedure  KeyPress(var Key: Char); override;
    procedure  KeyUp(var Key: Word; Shift: TShiftState)  ; override;
  public
    constructor create(Aowner:tcomponent);override;
 
    function Execute: Boolean;
  published
    property A_Valide           :boolean read  fvalide          write fvalide ;
    property A_AceptaNulos      :boolean read  FAceptaNulos     write FAceptaNulos ;
    property A_UseDefaultUser   :Boolean read  fUseUSRDFT       write fUseUSRDFT ;    //20130308
    property A_Valor            :string  read  fvalor           write fvalor ;   
    property A_TablaValidacion  :string  read  Ftable           write Ftable ;
    property A_CampoValidacion  :string  read  fkey1            write fkey1 ;
    property A_WHERE            :string  read  FWHERE           write FWHERE ;
    property A_Campo            :string  read  FField           write FField ;
    property A_FieldsShow       :string  read  FFieldsShow      write FFieldsShow ;
    property A_FOrderBy         :string  read  FOrderBy         write FOrderBy ;
    property A_Texto            :string  read  FTexto           write FTexto ;
    property A_key2             :string  read  fkey2            write fkey2 ;
    property A_Mensaje          :string  read  Fmensaje         write Fmensaje  ;
    property A_Numerico         :boolean read  Fnumerico        write Fnumerico ;
    property A_Decimales        :integer read  FDecimales       write FDecimales ;
    property A_tituloConsulta   :string  read  FtituloConsulta  write FtituloConsulta ;
    property A_GET_DEFAULT      :string  read  FGET_DEFAULT     write FGET_DEFAULT;
    property A_PGM_VALIDACION   :string  read  FPGM_VALIDACION  write FPGM_VALIDACION;       // 20111206
    property A_PGM_VALIDACIONOK :Boolean read  FPGM_VALIDACIONOK  write FPGM_VALIDACIONOK;   // 20131022
 
    property A_PGMCONSULTA      :string  read  FPGMCONSULTA  write FPGMCONSULTA;        //20130630
    property A_PGMASOCIADO      :string  read  FPGMASOCIADO  write FPGMASOCIADO;        //20130630
 
 
  //  property A_SQL_WHERE        :string read  FWHERE write FWHERE ;
    property A_FClientDataSet1  :TClientDataSet  read  FClientDataSet1 ;
    property A_Existe_Maestro   :boolean   read  FExisteMst write FExisteMst ;
    procedure A_FindMaster ;
    procedure FindMasterData;
    procedure A_VALIDAR_DATO() ;       //20090110
    procedure A_PGM_VALIDACION_EXE();  //20131022
 
  end;
 
 
procedure Register;
 
implementation
uses Global, MUConsulta,  TABLAS, TABLASSYS ;
 
procedure Register;
begin
  RegisterComponents('MULTINET', [TMUEDIT]);
end;
 
function TMUEDIT.Execute: Boolean;
VAR
 W_EXISTE:BOOLEAN;
begin
// ARMAR SQL
  W_SQL:= 'SELECT * FROM ' + Ftable + ' WHERE ' +  Trim(Fkey1) + '=' + QuotedStr(text);
   armar_sql;
   W_EXISTE:= D.GET_DATOS_GRL(W_SQL,FClientDataSet1);
   FdataSet:= FClientDataSet1;
   result:= W_EXISTE;  //2013-03-09
end;
 
Constructor  TMUEDIT.Create(Aowner:Tcomponent);
Begin
  inherited create(Aowner);
  fvalide     := true;
  FAceptaNulos:=False;
  fUseUSRDFT  :=True;  //20130308
  fNumerico   :=False;
  fdecimales  := -1;
  text        :='';
  FWHERE      :='';
  charcase    :=ecuppercase;
  ShowHint    :=True;
 
 
//  IF (Ftable = 'RESMST') and  (FField='RECURSO') then        // 20140328 prueba
//    MaxLength := 20;
 
 
  Hint:= 'Consultar F4 / F6 PgmAsoc/Doble Click ';  Hint := hint + 'F2,F6';
  Fmensaje:= '<-Dato Reportado No Existe';
 
  FClientDataSet1  :=TClientDataSet.Create(Self);
 
 
  // *********** CAMBIOS
 
  IF  fvalide = true THEN begin
 
    FQuery1          :=TSDQuery.Create(Self);
    FQuery1.DatabaseName := 'd';
 
    FDataSetProvider1:=TDataSetProvider.Create(Self);
    FDataSetProvider1.Options := [poAllowCommandText] ;
    FDataSetProvider1.DataSet :=  FQuery1  ;
 
 
    FClientDataSet1  :=TClientDataSet.Create(Self);
    FClientDataSet1.SetProvider(FDataSetProvider1);
 
//    FClientDataSet1.ProviderName := 'FDataSetProvider1';
    FClientDataSet1.PacketRecords :=-1;
 
  END;
End;
 
procedure TMUEDIT.DoEnter;
var
  w_flddefault:string;
begin
 
 
  IF (Ftable = 'RESMST') and  (FField='RECURSO') then        // 20140328 prueba
    MaxLength := 20;
 
 
  inherited;
  if fUseUSRDFT=True then     //20130308
     w_flddefault := fkey1;
 
  color := g_ColorOnEnter;
  SelectAll;
 
// SI REQUIERE USAR DEFAULT DEBE VENIR EL PARAMETRO EN BLANCO
  IF trim(TEXT)= '' Then begin
     //text:= D.GET_USRDFT(NAME);
    text:= D.GET_USRDFT(w_flddefault);
  end;
 
end;
 
procedure TMUEDIT.Click;
begin
  inherited;
end;
 
procedure TMUEDIT.DblClick;
begin
  inherited;
  consulte;
  A_FindMaster; // 2008-08-03
end;
 
 
// VERIFICA SI REQUIERE CAMPOS NUMERICOS
procedure TMUEDIT.KeyPress(var Key: Char);
begin
  if Key = #27 then begin
 
 
  end;
 
 if Fnumerico = True  then
    begin
      //        backspace,   0,   1,   2,  3,    4,  5,  6,  7,  8,  9   -  ,  ,   .    cr,  esc
      if (Key in [#8, #48, #49, #50, #51 ,#52, #53, #54, #55, #56, #57, #45, #44, #46, #13, #27 ] ) = False  then
          //else
          begin
            key := #0;                 //null
   MessageBeep(0);
          end
    end;
  end;
 
procedure TMUEDIT.KeyUp(var Key: Word; Shift: TShiftState) ;
begin
  inherited;
 IF KEY=  VK_F4  Then begin
   consulte;
   exit;
 end;
 
 IF (KEY=  VK_F6) AND (FPGMASOCIADO > '') Then begin
    DSYS.EJECUTAR_PROGRAMA(FPGMASOCIADO, 'M') ;
   exit;
 end;
 
 
 IF KEY=  VK_F5  Then begin
 end;
 
 
end;
 
 
 
// ****************************************************************************
procedure TMUEDIT.DoExit;
var
 // I : INTEGER;
  w_existe:boolean;
begin
  inherited;       // NO ACEPTA MOVER DATOS EN SALIR CAMPO DEBE SER POSTERIOR
 
//StringReplace(MaskEdit1.Text, ‘.’, ”, [rfReplaceAll]);
//StringReplace('1,250.25', '.', '', [rfReplaceAll]);
 
 
 
  A_FindMaster;
 
// VALIDAR S/N
  if (fvalide = false) then  begin
     color := clwindow;
     exit;
  end;
 
// SI NO REPORTA DATO Y SE REQUIERE VALIDAR DESPLIEGUE SELECCION DE DATOS
if  (length(text)= 0) or (Copy(text,1,1)=' ') then  begin
    consulte;
     SETFOCUS;
     exit;
end;
 
 
// VERIFICA SI EL DATO REPORTADO EXISTEA
  A_FindMaster;
  if FExisteMst = false then begin
     showmessage(TEXT + '<- ' + Fmensaje + ' en tabla:' + A_TablaValidacion  );        //20130706
     SETFOCUS;
     exit;
  end;
  color := clwindow;
 
exit ;
 
 
// ARMAR SQL
  armar_sql;
 
// VALIDAR DATO
  w_existe:=true;
 
 
  FClientDataSet1.close;
  FClientDataSet1.SetProvider(FDataSetProvider1);   // ?????
  fclientdataset1.CommandText:= W_SQL;
  FClientDataSet1.Open;
 
 
  // No existe registro reportado
  if FClientDataSet1.IsEmpty then begin
     w_existe:=false;
     FClientDataSet1.close;
 
     showmessage(TEXT + '<- ' + Fmensaje );
     SETFOCUS;
     exit;
  end;
  color := clwindow;
end;
 
 
procedure TMUEDIT.armar_sql;
begin
  IF FTABLE > ' ' then begin
     W_SQL:= 'SELECT * FROM ' + Ftable + ' WHERE ' +  Trim(Fkey1) + '=' + QuotedStr(text);
     IF FWHERE > '' then
        W_SQL:= W_SQL + 'AND ' + FWHERE;
     if A_FOrderBy   > '' then                  //20080514
        W_SQL:= W_SQL + ' ORDER BY ' + FOrderBy;
  end;
End;
 
 
// GENERAR DATOS
procedure TMUEDIT.consulte;
begin
// NO TIENE CONSULTA
  IF FTABLE = '' then exit;
 
  FMUCONSULTA:= TFMUCONSULTA.create(SELF);
  FMUCONSULTA.Caption := 'MUCONSULTA '+ FtituloConsulta;
  FMUCONSULTA.PANEL_TITULO.Caption  := Ftable + ' ' + FtituloConsulta;
  if FtituloConsulta = '' then
     FMUCONSULTA.Caption := 'MUCONSULTA Consulta:' + Ftable;
 
  FMUCONSULTA.P_TABLE  := Ftable;
  FMUCONSULTA.P_KEY1   := Fkey1;
 
  W_SQL:='SELECT * FROM ' + Ftable  ;
  IF FfieldsShow > '' Then
     W_SQL:='SELECT ' + FfieldsShow + ' FROM ' + Ftable ;
 
  IF FWHERE > '' then begin
    W_SQL:= W_SQL  + ' WHERE '  + FWHERE;
    FMUCONSULTA.P_SQL:= W_SQL;
  end;
 
    FMUCONSULTA.P_SQL:= W_SQL;
 
  Global.G_VALOR:= Text;  // Valor Existente
  FMUCONSULTA.ShowModal;
  if Global.G_VALOR > '' then BEGIN
    Text:= global.g_VALOR;
    FindMasterData;
  end;
 
end;
 
procedure TMUEDIT.FindMasterData;
var
 W_ISEMPTY:Boolean;
begin
// ARMAR SQL
  armar_sql;
  W_ISEMPTY:= D.GET_DATOS_GRL(W_SQL,FClientDataSet1);
end;
 
// RETORNA TRUE/FALSE SI EXISTE EL DATO
procedure TMUEDIT.A_VALIDAR_DATO  ;
var
 W_ISEMPTY:Boolean;
begin
// ARMAR SQL
  armar_sql;
  W_ISEMPTY:= D.GET_DATOS_GRL(W_SQL,FClientDataSet1);
end;
 
 
procedure TMUEDIT.A_PGM_VALIDACION_EXE  ;
var
 W_ISEMPTY:Boolean;
begin
// ARMAR SQL
// Fvalide := False ;
 
end;
 
 
 
procedure TMUEDIT.A_FindMaster;
begin
// ARMAR SQL
  armar_sql;
 
// VALIDAR DATO
  FExisteMst :=true;
 
if w_sql = '' then Begin
   FExisteMst:=false;
   exit;
end;
 
  FClientDataSet1.close;
  FClientDataSet1.SetProvider(FDataSetProvider1);   // ?????
  fclientdataset1.CommandText:= W_SQL;
  try
    FClientDataSet1.Open;
    if FClientDataSet1.IsEmpty then begin  // No existe registro reportado
       FExisteMst:=false;
    end;
  except
      on E: Exception do begin    //20140504
        showmessage(e.Message );  //20140504
 
     FExisteMst:=false;
     FClientDataSet1.close;
      end;
  end;
 
 
end;
 
 
end.
Link to comment
Share on other sites

Hi Salvatore,

(Hola Bresler

 

 estas en Cuba, hablas español, mi skype es logisticasoft Saludes y Gracias)

 

(if I understood) logisticasoft wants to make a new functionality to the component, which would creating a new form at runtime (using the trigger event I guess).

 

He is requesting your help.

 

Tonight I will try something (if Elizabeth wants :D). I´m not sure.

 

Best regards my friend

Link to comment
Share on other sites

  • 1 year later...
I can not make the component work when I create it at runtime.

This only occurs with creation at runtime, does anyone have any ideas?

If you also add some TriggersButtons at runtime, there is an ajax error Unexpected token,

 

O62=new Ext.form.field.Trigger({id:"O62_id",cls:"",emptyText:"",fieldLabel:"",labelPad:5,labelAlign:"top",labelSeparator:"",labelStyle:"white-space:nowrap; font-family: Tahoma; font-weight:normal; color : rgb(0 ,0 ,0); padding-bottom:5px;",labelWidth:5,width:250,minLength:0,maxLength:0,trigger1Cls:"x-form-Search-trigger",itemId1:"myteste",onTrigger1Click:function() { var Button = this.itemId1;  ajaxRequest(MainForm.,"Triggerclick",["Buttons="+Button]);},name:"O62",enableKeyEvents:true,tabIndex:12,width:250,x:408,y:344});O62.nm="O62";_cdo_("O62_C",O62,null,MainForm);O8.add(O62);O13.tabIndex=13;O13.addToTab(130);O17.tabIndex=14;O17.addToTab(140);O1B.tabIndex=15;O1B.addToTab(150);O1F.tabIndex=16;O1F.addToTab(160);O27.tabIndex=17;O27.addToTab(170);O2B.tabIndex=18;O2B.addToTab(180);O2F.tabIndex=19;O2F.addToTab(190);O33.tabIndex=20;O33.addToTab(200);O37.tabIndex=21;O37.addToTab(210);O47.tabIndex=22;O47.addToTab(220);O4B.tabIndex=23;O4B.addToTab(230);O62.addToTab(120);

Link to comment
Share on other sites

  • 1 year later...

Hello

If I use it in ContainerPanel or UniHiddenPanel, trigger event not fire. Here is log on web browser console

 

Uncaught ReferenceError: GeneralContainerPanel is not defined
    at j.onTrigger1Click (eval at AjaxSuccess (ext-unicommon-min.js:8), <anonymous>:1:18307)
    at j.onTriggerWrapClick (trigger.js:460)
    at HTMLTableElement.eval (eval at cacheableFunctionFactory (ext-all.js:18), <anonymous>:6:13)
    at HTMLTableElement.n (ext-all.js:18)
 
Uncaught ReferenceError: UniHiddenPanel1 is not defined
    at j.onTrigger1Click (eval at AjaxSuccess (ext-unicommon-min.js:8), <anonymous>:1:11337)
    at j.onTriggerWrapClick (trigger.js:460)
    at HTMLTableElement.eval (eval at cacheableFunctionFactory (ext-all.js:18), <anonymous>:6:13)
    at HTMLTableElement.n (ext-all.js:18)
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...