x11 Posted June 2, 2020 Share Posted June 2, 2020 А можно как-то у компоненты UniDBLookupComboBox/UnimDBLookupComboBox реализовать такую же возможность, как и у TUnimEdit со свойством EmptyText? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 2, 2020 Share Posted June 2, 2020 33 minutes ago, x11 said: UniDBLookupComboBox Есть свойство EmptyText. Quote Link to comment Share on other sites More sharing options...
x11 Posted June 2, 2020 Author Share Posted June 2, 2020 А вот у uniM На букву E есть только одно свойство - Enabled Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 2, 2020 Share Posted June 2, 2020 11 minutes ago, x11 said: А вот у uniM На букву E есть только одно свойство - Enabled Да, в ExtJS 7.0.0 Modern это свойство не реализовано. https://docs.sencha.com/extjs/7.0.0/modern/Ext.field.ComboBox.html Quote Link to comment Share on other sites More sharing options...
x11 Posted June 2, 2020 Author Share Posted June 2, 2020 Ещё у UnimDBLookupComboBox в событиях OnRemoteQuery и OnGetKeyValue не хватает параметра sender: TObject Поэтому на данный момент для всех лежащих на форме TUnimDBLookupComboBox приходится создавать отдельные события, вместо того, чтобы создать одно событие для всех этих компонент. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2020 Share Posted June 3, 2020 20 hours ago, x11 said: UnimDBLookupComboBox реализовать такую же возможность, как и у TUnimEdit со свойством EmptyText? 19 hours ago, Sherzod said: Да, в ExtJS 7.0.0 Modern это свойство не реализовано. Вы можете использовать этот конфиг: procedure TMainmForm.UniFormCreate(Sender: TObject); begin UnimDBLookupComboBox1.JSInterface.JSConfig('placeholder', ['EmptyText']); end; 2 Quote Link to comment Share on other sites More sharing options...
x11 Posted June 3, 2020 Author Share Posted June 3, 2020 Отлично. Будем надеяться, разработчики добавят это свойство в TUnimDBLookupComboBox 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted June 3, 2020 Author Share Posted June 3, 2020 4 hours ago, Sherzod said: Вы можете использовать этот конфиг: Усложняем. А можно ли в placeholder выводить иконку шрифта? <i class="fas fa-walking"></i> Если да, то как? А то выводится текст, как он есть вместо иконки. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2020 Share Posted June 3, 2020 59 minutes ago, x11 said: А можно ли в placeholder выводить иконку шрифта? Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 @Sherzod извините, я так и не понял, что именно надо сделать со списком? Какие свойства и какие там значение? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 5 minutes ago, x11 said: Какие свойства и какие там значение? Вы имеете в виду иконку? Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 Ну я вижу что у вас есть иконка, а у меня выводится <i class="fas fa-walking"></i> вместо иконки Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 comboSubway.JSInterface.JSConfig('placeholder', ['<i class="fas fa-walking"></i> метро']); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 Да, простите, это другой подход, я постараюсь дать решение. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 35 minutes ago, x11 said: comboSubway.JSInterface.JSConfig('placeholder', ['<i class="fas fa-walking"></i> метро']); procedure TMainmForm.UniFormCreate(Sender: TObject); begin with UnimDBLookupComboBox1 do begin JSInterface.JSAddListener('painted', 'function(){this.inputElement.setStyle("font-family", "FontAwesome")}'); JSInterface.JSConfig('placeholder', [#$f002 +' Search']); end; end; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 4 minutes ago, Sherzod said: #$f002 Подскажите, если передавать это в качестве параметра, то какой это тип в Delphi? Char, WideChar? Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 Всё, получилось, спасибо SetPlaceholderCombo('метро ', #$f002, comboSubway); procedure TfmmParentAparts.SetPlaceholderCombo(const placeholder: string; icon: char; combo: TunimDBLookupCombobox); begin combo.JSInterface.JSAddListener('painted', 'function(){this.inputElement.setStyle("font-family", "FontAwesome")}'); combo.JSInterface.JSConfig('placeholder', [icon + ' ' + placeholder]); end; 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 Чтобы "сохранить" шрифты, используйте такой код: with UnimDBLookupComboBox1 do begin JSInterface.JSAddListener('painted', 'function(){this.inputElement.setStyle("font-family", this.inputElement.getStyle("font-family") + ", FontAwesome")}'); JSInterface.JSConfig('placeholder', [#$f002 +' Search']); end; 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 Подскажите, почему некоторые иконки не отображаются? Например, вот https://fontawesome.com/icons/sign?style=solid https://fontawesome.com/icons/map-marker-alt?style=solid код такой же, как и для других списков SetPlaceholderCombo('вулиця', #$f4d9, comboStreets); SetPlaceholderCombo('район', #$f3c5, comboRegions); procedure SetPlaceholderCombo(const placeholder: string; icon: char; combo: TuniCustomCombobox); begin combo.JSInterface.JSAddListener('painted', 'function(){this.inputElement.setStyle("font-family", this.inputElement.getStyle("font-family") + ", FontAwesome")}'); combo.JSInterface.JSConfig('placeholder', [icon + ' ' + placeholder]); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 15 minutes ago, x11 said: Подскажите, почему некоторые иконки не отображаются? А если попробуете использовать только иконки FontAwesome4? Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 взял отсюда коды - с версией 4,7 работает https://fontawesome.com/v4.7.0/icon/map-marker https://fontawesome.com/v4.7.0/icon/map-signs Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 А версию 5 не получится использовать? А там уже и версия 6 скоро выйдет.... Quote Link to comment Share on other sites More sharing options...
x11 Posted June 4, 2020 Author Share Posted June 4, 2020 В общем, я придумал пока что вот так. В свойство FieldLabel я вставляю значение <i class="fas fa-subway"></i> В свойство FieldLabelWidth я указываю 7 (процентов). А placeholder заполняю без иконки procedure SetPlaceholderCombo(const placeholder: string; combo: TuniCustomCombobox); begin combo.JSInterface.JSConfig('placeholder', [placeholder]); end; 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2020 Share Posted June 4, 2020 8 minutes ago, x11 said: В общем, я придумал пока что вот так. Это тоже правильное решение на мой взгляд. 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted August 18, 2020 Author Share Posted August 18, 2020 Усложняем. А как получить этот placeholder? Начало здесь Ради экономии места на мобильной форме, иногда нет смысла выводить все названия. Но вдруг пользователь не поймет или забудет - что это за список или элемент ввода. К сожалению у TUnimDBLookupComboBox нет свойства EmptyText Спасибо. 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.