Canestraro Posted March 3, 2021 Share Posted March 3, 2021 I'm trying to pass this command but it returns the error when running, there is another way to send the css to TUniDateTimePicker? TUniDateTimePicker( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 3, 2021 Share Posted March 3, 2021 3 hours ago, Canestraro said: I'm trying to pass this command but it returns the error when running, there is another way to send the css to TUniDateTimePicker? TUniDateTimePicker( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); Hello, At what point do you execute this code? Provide your CSS completely. Quote Link to comment Share on other sites More sharing options...
Canestraro Posted March 4, 2021 Author Share Posted March 4, 2021 Follows CSS and error that appears .inputWithIcon input[type="text"] { padding-left: 40px ; } .inputWithIcon { position: relative ; } .inputWithIcon i { position: absolute; left: 0px; top: 0px; padding: 4.2px 4px; *: ; vertical-align: middle; width: 27px; /* height: 40px; */ color: #aaa; } .inputWithIcon.inputIconBg i { background-color: #fff; color: #b47e7e; padding: 4px 4px; width: 20px; height: 22px; border-radius: 4px 0 0 4px; border-left: 1px solid #9d9d9dd1; border-top: 1px solid #9d9d9dd1; border-bottom: 1px solid #9d9d9dd1; border-right: 0px solid #9d9d9dd1; z-index: 1000; } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 4, 2021 Share Posted March 4, 2021 8 minutes ago, Canestraro said: Follows CSS and error that appears 19 hours ago, Sherzod said: At what point do you execute this code? Quote Link to comment Share on other sites More sharing options...
Canestraro Posted March 4, 2021 Author Share Posted March 4, 2021 procedure TfraBaseCad.CarregarTamanho(vpClass : TClass); var _ctx : TRttiContext; _typ : TRttiType; _pro : TRttiProperty; oAtt : TCustomAttribute; vrComponent : TComponent; begin try _ctx := TRttiContext.Create; _typ := _ctx.GetType(vpClass); for _pro in _typ.GetProperties do begin for oAtt in _pro.GetAttributes do begin if oAtt is Column then begin vrComponent :=FindComponent('ed'+ _pro.Name); if vrComponent = nil then vrComponent := FindComponent('mm'+ _pro.Name); if vrComponent = nil then vrComponent := FindComponent('arq'+ _pro.Name); if vrComponent = nil then vrComponent := FindComponent('cb'+ _pro.Name); if vrComponent = nil then vrComponent := FindComponent('dt'+ _pro.Name); if vrComponent <> nil then begin if (vrComponent is TUniarqedit) then begin (vrComponent as TUniarqedit).MaxLength := 100; end else if (vrComponent is TUniArqComboBox) then begin (vrComponent as TUniArqComboBox).MaxLength := Column(oAtt).Tamanho; end else if (vrComponent is TUniedit) then begin (vrComponent as TUniEdit).MaxLength := Column(oAtt).Tamanho; end else if (vrComponent is TUniComboBox) then begin (vrComponent as TUniComboBox).MaxLength := Column(oAtt).Tamanho; end else if (vrComponent is TUniNumberEdit) then begin (vrComponent as TUniNumberEdit).MaxLength := Column(oAtt).Tamanho; end; if (Column(oAtt).Required) then begin //(Column(oAtt).Filtered) or (Column(oAtt).Required) then begin if (vrComponent is TUniArqFind) then begin (vrComponent as TUniArqFind).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniArqEdit) then begin (vrComponent as TUniArqEdit).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniArqComboBox) then begin (vrComponent as TUniArqComboBox).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniComboBox) then begin (vrComponent as TUniComboBox).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniedit) then begin (vrComponent as TUniEdit).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniComboBox) then begin (vrComponent as TUniComboBox).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniNumberEdit) then begin (vrComponent as TUniNumberEdit).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniDateTimePicker) then begin (vrComponent as TUniDateTimePicker).Hint := Column(oAtt).Campo; end else if (vrComponent is TUniSpinEdit) then begin (vrComponent as TUniSpinEdit).Hint := Column(oAtt).Campo; end ; end; if Column(oAtt).Required = true then begin if (vrComponent is TUniArqFind) then begin TUniArqFind( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniArqFind( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniArqFind( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniArqFind( vrComponent).FieldLabelWidth := 15; TUniArqFind( vrComponent ).FieldLabelSeparator := ''; TUniArqFind( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniArqEdit) then begin TUniArqEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniArqEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniArqEdit( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniArqEdit( vrComponent).FieldLabelWidth := 15; TUniArqEdit( vrComponent ).FieldLabelSeparator := ''; TUniArqEdit( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniArqComboBox) then begin TUniArqComboBox( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniArqComboBox( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniArqComboBox( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniArqComboBox( vrComponent).FieldLabelWidth := 15; TUniArqComboBox( vrComponent ).FieldLabelSeparator := ''; TUniArqComboBox( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniedit) then begin TUniEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniEdit( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniEdit( vrComponent).FieldLabelWidth := 15; TUniEdit( vrComponent ).FieldLabelSeparator := ''; TUniEdit( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniComboBox) then begin TUniComboBox( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniComboBox( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniComboBox( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniComboBox( vrComponent).FieldLabelWidth := 15; TUniComboBox( vrComponent ).FieldLabelSeparator := ''; TUniComboBox( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniNumberEdit) then begin TUniNumberEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniNumberEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniNumberEdit( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniNumberEdit( vrComponent).FieldLabelWidth := 15; TUniNumberEdit( vrComponent ).FieldLabelSeparator := ''; TUniNumberEdit( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniSpinEdit) then begin TUniSpinEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; TUniSpinEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniSpinEdit( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniSpinEdit( vrComponent).FieldLabelWidth := 15; TUniSpinEdit( vrComponent ).FieldLabelSeparator := ''; TUniSpinEdit( vrComponent ).FieldLabelAlign := laLeft; end else if (vrComponent is TUniDateTimePicker) then begin TUniDateTimePicker( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}'; //TUniDateTimePicker( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']); TUniDateTimePicker( vrComponent ).FieldLabel := '<i class="fas fa-exclamation-circle"></i>'; TUniDateTimePicker( vrComponent).FieldLabelWidth := 15; TUniDateTimePicker( vrComponent ).FieldLabelSeparator := ''; TUniDateTimePicker( vrComponent ).FieldLabelAlign := laLeft; end; end; end; end; end; end; finally _ctx.Free; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 4, 2021 Share Posted March 4, 2021 7 minutes ago, Canestraro said: It seems you have solved the problem by using ClientEvents? Quote Link to comment Share on other sites More sharing options...
Canestraro Posted March 4, 2021 Author Share Posted March 4, 2021 yes, but understand why it didn't work the other way. I will try to give one more study. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 4, 2021 Share Posted March 4, 2021 2 minutes ago, Canestraro said: yes, but understand why it didn't work the other way. I will try to give one more study. When "creating" you should not use JSCall, use JSConfig instead... Quote Link to comment Share on other sites More sharing options...
Canestraro Posted March 4, 2021 Author Share Posted March 4, 2021 Thanks Quote Link to comment Share on other sites More sharing options...
zanona Posted July 19, 2021 Share Posted July 19, 2021 I'm having the same problem! I tried the suggestion above but it gave the same error. Would it be this way? UniDateTimePicker1.JSInterface.JSConfig( 'addCls' , [vrsJsCall]); Thansk's Quote Link to comment Share on other sites More sharing options...
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.