Перейти к содержанию

Дайджест за январь-март

Обновления гайдов и аддонов

Март Февраль Январь

Мониторинг серверов и редактор аддонов

Представляем вам две легенды. То, о чем можно было только мечтать, стало реальностью.

Мониторинг серверов Редактор аддонов

Бот статистики для Telegram

Удобная аналитика в телефоне.

Подробнее

Подсказки из игры на вашем сайте

Теперь вы можете отображать сведения о внутриигровых элементах простым наведением курсора мыши.

Подробнее

Апдейтер аддонов

Представляем вам программу для автообновления аддонов и делимся подробностями.

Подробнее Скачать

Question about widgets(buttons)


timbuktu93

Рекомендуемые сообщения

Hello,

i have some problems in my addon with a button. I am using 2 variants to switch the layout from the button in an active and deactivated status. So that you can see that its deactivated when it is grey. I am addin a label to it, when its in the active state(variant 0): wtMainButton:SetVal( "button_label", userMods.ToWString( "ATK" ) )

When it is in variant 1 i want to set a different label wtMainButton:SetVal( "button_label", userMods.ToWString( "-" ) ). But it does not show up and i dont know why. The TextTag "button_label" in my button.xdb is outside of the 2 variants, so both should be able to reference it. I dont get any errors. It just doesnt show up.

 

Can anybody help me here?

 

Greets!

Ссылка на комментарий
Поделиться на другие сайты

For a disabled button, you don't need to create a separate Variant. You can use wtButton:Enable(false), and the game will automatically make the texture gray.

However, if you specifically need a second Variant, you must specify FormatFileRef (a reference to the formatting file) in StateNormal for each Variant. Like this:

<TextTag>button_label</TextTag>
<Variants>
  <Item>
    <StateNormal>
      <LayerMain href="..." />
      <FormatFileRef href="ButtonFormat.txt" />
    </StateNormal>
  </Item>
  <Item>
    <StateNormal>
      <LayerMain href="..." />
      <FormatFileRef href="ButtonFormat.txt" />
    </StateNormal>
  </Item>
</Variants>

 

Ссылка на комментарий
Поделиться на другие сайты

I tried wtButton:Enable(false) before I used the variants. But somehow I was not able to reactivate the button per click.  I looked like it was totally deactivated until I reload the addon. I think my button.xdb looks exactly like you wrote. I will check that later/tomorrow.

But thanks for the reply

Ссылка на комментарий
Поделиться на другие сайты

On 9/25/2026 at 11:24 AM, Slashuur said:

For a disabled button, you don't need to create a separate Variant. You can use wtButton:Enable(false), and the game will automatically make the texture gray.

However, if you specifically need a second Variant, you must specify FormatFileRef (a reference to the formatting file) in StateNormal for each Variant. Like this:

<TextTag>button_label</TextTag>
<Variants>
  <Item>
    <StateNormal>
      <LayerMain href="..." />
      <FormatFileRef href="ButtonFormat.txt" />
    </StateNormal>
  </Item>
  <Item>
    <StateNormal>
      <LayerMain href="..." />
      <FormatFileRef href="ButtonFormat.txt" />
    </StateNormal>
  </Item>
</Variants>

 

I tried the function wtButton:Enable(false), but now I have the same problem again. The button is disabled and the label works now.  But I looks like it does not react on my clicks. I can move it around in game but I am not able to switch in beck to wtButton:Enable(true)

Ссылка на комментарий
Поделиться на другие сайты

Присоединяйтесь к обсуждению

Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Восстановить форматирование

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

×
×
  • Создать...

Важная информация

Пользуясь сайтом, вы принимаете Условия использования