Jump to content


Photo

easy add TUniEventStrings


  • Please log in to reply
2 replies to this topic

#1 Freeman35

Freeman35

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 177 posts

Posted 31 July 2017 - 03:33 PM

When use inherited form, add this code to parent form and forget add css code or etc.

I couldn't find function's headers so wrote two headers in "case func_id of"

Would you wanna improve fill free, or gorget it.

uses uniGUIClientEvents, // for TUniEventStrings class don't forget
procedure UGS_ch_func(E: TUniEventStrings; Txt: string; func_id: Integer = 0);
var I: Integer;
    S, func, Head: string;
begin
  if(Txt='')or(func_id<0)then Exit;
  case func_id of
    0: begin func:='beforeInit'; Head:= 'function beforeInit(sender, config){'; end;
    1: begin func:='added'; Head:= 'function added(sender, container, pos, eOpts){'; end;
  end;
  S:= E.Values[func].TrimRight;
  I:= LastDelimiter('}', S.TrimRight);
  if I>0then Delete(S, I, 1);
  I:= Pos('{', S);
  if I>0then begin
    Head:= Copy(S, 1, I);
    Delete(S, 1, I);
    S:= S.TrimLeft;
  end;
  with TStringList.Create do begin
    Text:= Head +S.TrimRight;
    Add(Txt);
    E.Values[func]:= Text +'}';
    Free;
  end;
end;

how to use:

procedure TaFRM_.UniFormCreate(Sender: TObject);
var I: Integer;
begin
   for I:=0to Self.ComponentCount-1do begin
     if Self.Components[I]is TUniDBEdit then
       UGS_ch_func((Self.Components[I]as TUniDBEdit).ClientEvents.UniEvents, Format('sender.inputCls=%s;',[QuotedStr('EDT_css')]), 0);
     if Self.Components[I]is TUniLabel then
       UGS_ch_func((Self.Components[I]as TUniLabel).ClientEvents.ExtEvents, Format('sender.addCls(%s);',[QuotedStr('LBL_css')]), 1);
   end;
end;
procedure TFRM_Detay.UniFormCreate(Sender: TObject);
begin
  inherited;// here EDT_css added
  UGS_ch_func(EDT_Adi.ClientEvents.UniEvents, 'config.emptyText = ' +QuotedStr('Adı'));

  • 1

#2 delagoutte

delagoutte

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 296 posts

Posted 01 August 2017 - 09:01 AM

thank you


  • 0

#3 _Mehmet_

_Mehmet_

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 486 posts
  • LocationAntalya / Turkey

Posted 01 August 2017 - 01:05 PM

Teşekkürler.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users