x11 133 Posted December 5, 2020 Share Posted December 5, 2020 Уважаемые разработчики, сделайте, пожалуйста так, чтобы срабатывали триггеры, даже если у компонентов включено свойство ReadOnly. Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 Можно ли как-то сделать, чтобы были видимы и работали кнопки триггеров, если у компоненты свойство ReadOnly включено? Если да, то как? Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 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 Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 Ajax error Quote value.setDisabled is not a function Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 16 minutes ago, x11 said: Ajax error Quote UnimEdit ? Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 Нет. В данном случае десктопный TUniEdit. Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 Just now, x11 said: В данном случае десктопный TUniEdit. Я проверю. Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 10 minutes ago, x11 said: В данном случае десктопный TUniEdit. Вы можете использовать этот конфиг, вместо ReadOnly = True procedure TMainForm.UniFormCreate(Sender: TObject); begin UniEdit1.JSInterface.JSConfig('editable', [False]) end; Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 А urmNotEditable это не то же самое? 1 Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 4 minutes ago, x11 said: А urmNotEditable это не то же самое? Да, в Вашем случае, с ReadOnly = True Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 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; Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 3 minutes ago, x11 said: SetEditable(fmUserEdit.edPass, True); ? Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 4 minutes ago, Sherzod said: Да, в Вашем случае, с ReadOnly = True ааа, т.е. urmNotEditable работает в паре только с ReadOnly, т.е. зависит от него? Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 Just now, Sherzod said: ? это я просто обернул в процедуру: constEditable = 'editable'; ... ... ... procedure SetEditable(UniControl: TUniControl; val: boolean = False); begin UniControl.JSInterface.JSConfig(constEditable, [val]) end; Quote Link to post Share on other sites
Sherzod 1148 Posted January 9 Share Posted January 9 1 minute ago, x11 said: JSConfig Только при инициализации. 1 minute ago, x11 said: UniControl.JSInterface.JSConfig(constEditable, [val]) UniControl.JSInterface.JSCall('setEditable', [True]) 1 Quote Link to post Share on other sites
x11 133 Posted January 9 Author Share Posted January 9 В общем, у меня получилось с помощью 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 Quote Link to post Share on other sites
x11 133 Posted January 25 Author Share Posted January 25 On 1/9/2021 at 7:04 PM, Sherzod said: Да, в Вашем случае, с ReadOnly = True мобильной компоненте unimEdit тоже не помешало бы свойство "urmNotEditable" Quote Link to post Share on other sites
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.