armory3d / zui

Immediate Mode User Interface
zlib License
314 stars 62 forks source link

Tooltips for inlineRadio #151

Closed MathemanFlo closed 2 years ago

luboslenco commented 2 years ago

Is there a way to let user call ui.tooltip() manually like in other cases? I guess we would need to expose actively hovered item?

MathemanFlo commented 2 years ago

This is a good question. I thought about that, too. The problem is that inlineRadio is more a container of multiple controls inside and it has no real interface to communicate a hovered state to the caller. E.g. the Started, Hovered, ... state known from image or label. I can imagine multiple solutions.

  1. We simply skip this feature. It is really not that important and I could change https://github.com/armory3d/armorpaint/pull/1313/commits/501af489f3772190a46f593e1d121df1626a29de to use one tooltip instead of multiple. At the moment it is really only for this case.
  2. We could use the handle to communicate the hovered state. I.e. by always setting handle.position = hovered; and indicate actual changes by return value (as we do now). It's still inconsistent with other controls though...
var handle : Handle = ...;
var selectedValue = Ext.inlineRadio(ui, handle, ["A", "B"], Left);
if (ui.isHovered && handle.position == 0) ...
else if (ui.isHovered && handle.position == 1) ...
  1. We could change the return type to something more complex, but that sounds not like the best idea.
  2. We could add a hover function that can be passed by parameter. Still not convinced. So I don't mind. Decide as you would like to.
luboslenco commented 2 years ago

We simply skip this feature. It is really not that important and I could change https://github.com/armory3d/armorpaint/commit/501af489f3772190a46f593e1d121df1626a29de to use one tooltip instead of multiple. At the moment it is really only for this case.

Oki, let's skip this one for now but would love to revisit it eventually. Can do a re-think of zui design in the future, now that there is a lot of experience gained from the zui usage in ArmorPaint. 🙂

MathemanFlo commented 2 years ago

I completely agree. In general zui is well designed and flexible but it could use some redesign for sure as any grown code base.