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

Дайджесты за январь-февраль

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

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

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

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

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

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

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

Подробнее

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

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

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

Tooltip: WIDGET_SIZING_CHILDREN/WIDGET_SIZING_INTERNAL?


BhaaL

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

I'm trying to create a tooltip that looks like the ones that show up when hovering any item in the inventory - Item description at the top (which varies in height when more/less text is shown) and a fixed size footer showing some options (like left-click does something, right-click does something else).

For now, I use a simple tooltip like this (with a ValuedText as TooltipText):

Code:
Tooltip.WidgetPanel (WIDGET_SIZING_CHILDREN, sizingWidget = TooltipText)

+-TooltipText.WidgetTextView (WIDGET_SIZING_INTERNAL)

Works just fine, but as soon as I try to add more children to Tooltip i either get overlapping Controls (TooltipText is shown above/below the other stuff) or sizing is completely off.

I tried something like this for example:

Code:
Tooltip.WidgetPanel (WIDGET_SIZING_CHILDREN, sizingWidget = TooltipText)

+-TooltipText.WidgetTextView (WIDGET_SIZING_INTERNAL)

+-LeftClickIcon.WidgetPanel (WIDGET_SIZING_DEFAULT, BackLayer set to image)

+-LeftClickText.WidgetTextView (WIDGET_SIZING_DEFAULT)

+-RightClickIcon.WidgetPanel (WIDGET_SIZING_DEFAULT, BackLayer set to image)

+-RightClickText.WidgetTextView (WIDGET_SIZING_DEFAULT)

and

Code:
Tooltip.WidgetPanel (WIDGET_SIZING_CHILDREN, sizingWidget = TooltipText)

+-TooltipText.WidgetTextView (WIDGET_SIZING_INTERNAL)

+-Footer.WidgetPanel (WIDGET_SIZING_DEFAULT)

  +-LeftClickIcon.WidgetPanel (WIDGET_SIZING_DEFAULT, BackLayer set to image)

  +-LeftClickText.WidgetTextView (WIDGET_SIZING_DEFAULT)

  +-RightClickIcon.WidgetPanel (WIDGET_SIZING_DEFAULT, BackLayer set to image)

  +-RightClickText.WidgetTextView (WIDGET_SIZING_DEFAULT)

...all to no avail.

Does anyone know what I'm missing here?

Edit:

Looks like this right now:

4tui44.jpg

A sample project can be found here: http://www.mediafire.com/?d9b6gqumnhgo886

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

The standard tooltip you see in game is actually a Panel containing a resizing Container. You can directly collect the tooltip in-game, recreate it (GetWidgetDesc() and CreateWidgetByDesc()) and play with it that way. Bear in mind however that the game uses a script known as a WidgetFactory to quickly create all the widgets that are fed into the Tooltip. So most of the additives will be external to what is provided by recreating the Tooltip directly. I once toyed around with doing this as well; I'll try and see if I can find my code somewhere to give you, if you want it.

The new PlayerHUD on Curse and DamageMeters/PLATES have some quick tooltips for using the features you're working with though.

Edit:

Code:
Tooltip = mainForm:CreateWidgetByDesc(stateMainForm:GetChildChecked("ContextTooltip", true):GetChildChecked("Tooltip", false):GetWidgetDesc())

Container = Tooltip:GetChildChecked("Container", false)

Oh, and for your current code, try setting them all to be sizingWidgets, as just one is going to fit to the size of just one.

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

Are you trying to say that the game actually calculates the sizes in code, rather than relying on SIZING_CHILDREN/_INTERNAL? SLA had a post about those two in his Minimap Adventures thread, but I didn't have any success yet on getting the thing to work with more than just one Widget in there.

I know about sizingWidgets (plural, thats an element in the same place as sizingWidget, which takes a list), but it didn't really work out either (especially since the dynamic sizing shouldn't be done on the static content, which I think the element is for.

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

No, the game doesn't calculate the size rather than relying on Children and Internal. I'm saying that the game has a Panel with sizingWidget set to the Container, then the game fills the Container with stuffs and the Panel resizes accordingly.

Edit: It's actually a really simple resize. Since the Container has no defined size, and also resizes based on what is inside of it. It just stacks things like a text container.

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

I think the Problem is that I have two things that should size...

The tooltip (WidgetPanel) should be as large as all of its contents - and the content is a variable sized text area (WidgetTextView) and some fixed sizes footer panel (WidgetPanel).

The content text area (WidgetTextView) should be as large as the text (or here: ValuedText) I put inside.

Gonna try something else, but I'm not sure if adding an extra container in-between will help...

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

Where's the static part in your sample thats NOT resized by the game but fixed height?

15vc4g.png

I understood what you wanted to tell me with the container, but thats also what I do/did for simple tooltips with just text.

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

It's all dynamic. My sample is direct copy of the real tooltip that you show pictures of.

Edit: To better explain; everything you see in the in-game tooltip is slapped into a Container. Nothing is static but the items in the Container themselves.

Maybe a picture will explain it better.

dg2mom.png

This is using the exact same resources I just gave you except for the fact that I removed all the excess from ContInternal except for the one TextView and doubled the TextView to allow for multiple locations at the same line.

What you see is done with six of the exact same widgets created then dynamically changed via simple "fontsize='#'" code.

To create the objects that you consider "Static", they are simply stored versions of the same idea that are dynamically added when necessary via the same Container:PushBack(*clickIconWidget*)

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

Edit: Argh! I just compared my stuff again to your code, and randomly changed things around until I got a "cannot find child named 'xx'" error.

Turns out that my Widget was called "Tooltip" while the one from stateMainForm is also called "Tooltip". And apparently by calling mainForm:CreateWidgetByDesc it created and added a new "Tooltip" to my mainForm, confusing all the rest of the code.

Suddenly it all works just fine, and I feel like the solution hit me straight in the face for 2 weeks.

----------------

I just find it disturbing that I *have to* resort to code when everything is mostly static and could be done by XDB alone.

Some further testing revealed that either 2.0.06 is bugged there, or I'm doing something plain wrong.

Adding my contents to a WidgetSimpleTable by adding them to the <Children> collection via XDB and setting the Table as sizingWidget of the Tooltip had me end up with an empty box of about 20x20, with no contents at all.

Doing the same from Code (like AddonManager r4 does) had the same result, except that my children werent added to the container but to the mainForm (altho using container:PushBack(childWidget))

Using a WidgetPanel instead of a WidgetSimpleTable just obviously throws a "attempt to call method `PushBack' (a nil value)" because a Panel has no PushBack method.

GUI coding can really be frustrating at times =/

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

Yeh, it is frustrating, especially when most of it isn't really revealed.

You can make "static" widgets or widgetDesc's via adding them to the MainForm of your add-on similar to how I did in my example. This is kind of how certain things are done in the real tooltip, where instead of running a bunch of code to create a commonly used widget they just call on a CreateWidgetByDesc() for that widget. Then you just call on them and change parts and slap 'em in when needed, that's how the devs do it.

Take a look at the 1.0.03 ContextTooltip scripts.

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

Will do. Do you happen to know if the XDBs are also around somewhere? All I've seen so far were either the old 1.0.03 scripts and the current compiled luac, but I've never seen any XDB files (or text files with format, for that).

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

Nope, only the ResourceSystem stuff.

There are some add-ons around with good Container design though, as you already know.

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

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

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

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

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

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

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

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

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

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