Jump to content

UnimDBLookupComboBox + EmptyText


x11

Recommended Posts

А можно как-то у компоненты UniDBLookupComboBox/UnimDBLookupComboBox реализовать такую же возможность, как и у TUnimEdit со свойством EmptyText?

 

 

Link to comment
Share on other sites

Ещё у UnimDBLookupComboBox  в событиях OnRemoteQuery и OnGetKeyValue не хватает параметра sender: TObject

Поэтому на данный момент для всех лежащих на форме TUnimDBLookupComboBox приходится создавать отдельные события, вместо того, чтобы создать одно событие для всех этих компонент.

Link to comment
Share on other sites

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;

 

  • Like 2
Link to comment
Share on other sites

4 hours ago, Sherzod said:

Вы можете использовать этот конфиг:

 

Усложняем.

А можно ли в placeholder выводить иконку шрифта?

<i class="fas fa-walking"></i>

Если да, то как?

А то выводится текст, как он есть вместо иконки.

Screenshot_16.jpg

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

4 minutes ago, Sherzod said:

#$f002

Подскажите, если передавать это в качестве параметра, то какой это тип в Delphi? Char, WideChar?

Link to comment
Share on other sites

Всё, получилось, спасибо

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;

 

  • Like 1
Link to comment
Share on other sites

Чтобы "сохранить" шрифты, используйте такой код:

  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;

 

  • Like 1
Link to comment
Share on other sites

Подскажите, почему некоторые иконки не отображаются?

Например,  вот

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;

 

Screenshot_34.jpg

Link to comment
Share on other sites

15 minutes ago, x11 said:

Подскажите, почему некоторые иконки не отображаются?

А если попробуете использовать только иконки FontAwesome4?

Link to comment
Share on other sites

В общем, я придумал пока что вот так.

В свойство FieldLabel я вставляю значение <i class="fas fa-subway"></i>

В свойство FieldLabelWidth я указываю 7 (процентов).

А placeholder заполняю без иконки

procedure SetPlaceholderCombo(const placeholder: string; combo: TuniCustomCombobox);
begin
  combo.JSInterface.JSConfig('placeholder', [placeholder]);
end;

 

Screenshot_36.jpg

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Усложняем.

А как получить этот placeholder?

Начало здесь

Ради экономии места на мобильной форме, иногда нет смысла выводить все названия. Но вдруг пользователь не поймет или забудет - что это за список или элемент ввода.

К сожалению у TUnimDBLookupComboBox нет свойства EmptyText :(

Спасибо.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...