x11 Posted December 5, 2020 Share Posted December 5, 2020 Уважаемые разработчики, сделайте, пожалуйста так, чтобы срабатывали триггеры, даже если у компонентов включено свойство ReadOnly. Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 up Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 Можно ли как-то сделать, чтобы были видимы и работали кнопки триггеров, если у компоненты свойство ReadOnly включено? Если да, то как? Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 2 hours ago, x11 said: Можно ли как-то сделать, чтобы были видимы и работали кнопки триггеров, если у компоненты свойство ReadOnly включено? Если да, то как? Здравствуйте, function afterCreate(sender) { let items = sender.getTriggers(); for (let [key, value] of Object.entries(items)) { if (key !== "clear") { value.setDisabled(false); } }; } 1 Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 Ajax error Quote value.setDisabled is not a function Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 16 minutes ago, x11 said: Ajax error Quote UnimEdit ? Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 Нет. В данном случае десктопный TUniEdit. Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 Just now, x11 said: В данном случае десктопный TUniEdit. Я проверю. Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 10 minutes ago, x11 said: В данном случае десктопный TUniEdit. Вы можете использовать этот конфиг, вместо ReadOnly = True procedure TMainForm.UniFormCreate(Sender: TObject); begin UniEdit1.JSInterface.JSConfig('editable', [False]) end; Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 А urmNotEditable это не то же самое? 1 Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 4 minutes ago, x11 said: А urmNotEditable это не то же самое? Да, в Вашем случае, с ReadOnly = True Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 8 minutes ago, Sherzod said: Вы можете использовать этот конфиг Теперь другая проблема. С триггером. Когда на него нажимаю, чтобы разрешить редактирование поля, то появляется ошибка: Quote Config Option: O681->editable:true<br/>is refering a previous request,<br/>it's not allowed in AJAX request or JS handler.<br/>Use equivalent Public Property or Method instead. вот код триггера: procedure TfmUserEdit.edPassTriggerEvent(Sender: TUniFormControl; AButtonId: Integer); begin inherited; if AButtonId = 0 then begin // разрешить ввод нового пароля edPass.Tag := 1; SetEditable(fmUserEdit.edPass, True); edPass.Text := ''; edPass.SetFocus; end; end; Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 3 minutes ago, x11 said: SetEditable(fmUserEdit.edPass, True); ? Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 4 minutes ago, Sherzod said: Да, в Вашем случае, с ReadOnly = True ааа, т.е. urmNotEditable работает в паре только с ReadOnly, т.е. зависит от него? Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 Just now, Sherzod said: ? это я просто обернул в процедуру: constEditable = 'editable'; ... ... ... procedure SetEditable(UniControl: TUniControl; val: boolean = False); begin UniControl.JSInterface.JSConfig(constEditable, [val]) end; Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2021 Share Posted January 9, 2021 1 minute ago, x11 said: JSConfig Только при инициализации. 1 minute ago, x11 said: UniControl.JSInterface.JSConfig(constEditable, [val]) UniControl.JSInterface.JSCall('setEditable', [True]) 1 Link to comment Share on other sites More sharing options...
x11 Posted January 9, 2021 Author Share Posted January 9, 2021 В общем, у меня получилось с помощью ReadOnly+ ReadOnlyMode. Я не знал ранее, что они взаимосвязаны. Хотя в справке все это написано. procedure TfmUserEdit.edPassTriggerEvent(Sender: TUniFormControl; AButtonId: Integer); begin inherited; if AButtonId = 0 then begin //нажали троггер для смены пароля edPass.Triggers[AButtonId].Visible := false; edPass.Tag := 1;// метка того, что пароль будет изменен edPass.ReadOnly := false; edPass.Text := ''; edPass.SetFocus; end; end; В общем, чтобы были видимы триггеры, нужно переключать свойство ReadOnlyMode в состояние urmNotEditable, тогда и элемент будет НЕредактируемым и триггеры будут видимыми. Поэтому в моем случае достаточно включить urmNotEditable и можно управлять свойством ReadOnly и оно не будет влияет на видимость триггеров. 1 Link to comment Share on other sites More sharing options...
x11 Posted January 25, 2021 Author Share Posted January 25, 2021 On 1/9/2021 at 7:04 PM, Sherzod said: Да, в Вашем случае, с ReadOnly = True мобильной компоненте unimEdit тоже не помешало бы свойство "urmNotEditable" Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now