Add Tooltip to each UI Tree Checkbox in App Designer

70 ビュー (過去 30 日間)
Ravindra Goyal
Ravindra Goyal 2025 年 11 月 21 日 8:43
編集済み: dpb 2025 年 11 月 24 日 14:02
In App Desinger I want to add tooltips to each ui tree checkbox, so here each checkbox shall tell the user more of what is done or checked with the check exactly. Example: For "Block Colors" a tooltip might show something like "Checks if each Simulink Block has its dedicated color as defined by the company guidelines". Is there an option, as I can only find to add a tooltip to the parent CheckBoxTree but not each individual checkbox? Thank you.

採用された回答

Yair Altman
Yair Altman 2025 年 11 月 22 日 19:31
I am not aware of any easy way to do this in the new web-figures. In the old Java-based figures it was easy to attach user-defined mouse-move callbacks that would update the control's tooltip (see this oldie for example), but the new UI makes it much more difficult.
I can think of 2 sub-optimal workarounds:
  1. Use Javascript code to implement the dynamic tooltip behavior. Alas, attaching JS code to Matlab UI is not an easy task at all (it should be, but MW for reasons unknown chose not to expose this UI-JS interface to end-users like us).
  2. Implement a user-defined SelectionChangedFcn callback, such that when the user clicks on any tree node, the tree's Tooltip property is updated based on the updated SelectedNodes property. This is certainly less useful than a dynamic mouse-hover tooltip, but at least better than nothing.
Perhaps someone finds an easier solution, I'd be happy to hear. I haven't found one [yet], and I don't know if any such easier solution even exists.
  4 件のコメント
Ravindra Goyal
Ravindra Goyal 2025 年 11 月 24 日 7:49
編集済み: Ravindra Goyal 2025 年 11 月 24 日 7:49
Thank you guys for your quick feedback! Yair, I've studied your books back and forth in Uni when still building with GUIDE, now with App Designer I am getting back to the roots it seems. Thank you also dpb for your comments and the idea for custom callbacks! I guess I can not go down the road, as customer money is too tight for multiday attempts I feel... (but will try a few hours if spared :)
dpb
dpb 2025 年 11 月 24 日 13:23
編集済み: dpb 2025 年 11 月 24 日 14:02
It's a pretty steep learning curve, for sure, it appears, particularly as (per too often usual) the examples provided are essentially trivial rather than really extending or creating new behavior.
It does look as though the classes are in m-code, however; I think if I were to really try to do something this sophisticated I would make a local copy of the base creator code and see about extending it directly rather than futzing around with the AppDesigner framework.
But, having spent 30+ yr in the consulting gig, I understand all too well the time constraints funding places on what one would like to do versus what one can afford to spend the time doing.

サインインしてコメントする。

その他の回答 (2 件)

dpb
dpb 2025 年 11 月 21 日 17:05
No, the 'Tooltip' property is a member of only the uitree object; the children of the tree do not have such.
Seems like a reasonable enhancement request, but no way to do it at present. There aren't any callbacks defined, either, so using one of those to display some text in a 'Tag' doesn't work, either. I did not explore whether one can use 'addlistener' to the nodes or not.

Image Analyst
Image Analyst 2025 年 11 月 21 日 17:14
編集済み: Image Analyst 2025 年 11 月 22 日 23:25
  1 件のコメント
dpb
dpb 2025 年 11 月 21 日 17:39
編集済み: dpb 2025 年 11 月 21 日 20:00
While Yair is certainly the preminent whizard, I'm afraid most of his firepower for this sort of thing has been neutered by Mathworks in R2025 unless one also loads the JVM that isn't done any more by default. If go that route, then would revert to using prior SWING controls instead of the new MATLAB-supplied ui-replacements.
Would love be be shown my assumptions are in error... <vbg>
Here's <link to Yair's answer> to a thread a couple of years ago about relevance of his Java enhancements book that kinda' outlines where heading was then -- with R2025 Mathworks did finally take the plunge.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by