Freeman35 Posted July 31, 2017 Posted July 31, 2017 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.