Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.

More

The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

Tooltip: WIDGET_SIZING_CHILDREN/WIDGET_SIZING_INTERNAL?


BhaaL
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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*)

Link to comment
Share on other sites

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 =/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

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.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use