4
$\begingroup$

Is it possible to show Tooltips in a ListPicker menu?

This effect is possible using TabView, but I would much prefer using ListPicker.

Below is a simplified version of my code.

ItemList =
  {"Apples",
   "Oranges",
   "Bananas",
   "Watermelon"};
ReviewsList =
  {"10 Reviews",
   "7 Reviews",
   "16 Reviews",
   "12 Reviews"};
TooltipList =
  {"5 Positive, 3 Neutral, 2 Negative",
   "4 Positive, 1 Neutral, 2 Negative",
   "10 Positive, 2 Neutral, 4 Negative",
   "6 Positive, 3 Neutral, 3 Negative"};
CombinedList = Table[Column[
    {Style[ItemList[[i]], FontColor -> Purple, 
      FontFamily -> "Verdana", FontSize -> 12, FontWeight -> Bold],
     Tooltip[
      Style[ReviewsList[[i]], FontFamily -> "Verdana", 
       FontSize -> 12], TooltipList[[i]]]}
    ], {i, 1, 4}];

(* Column *)
Column[CombinedList]

(* TabView *)
TabView[Table[CombinedList[[i]] -> 1, {i, 1, 4}], Dynamic[x], 
 ControlPlacement -> Left]

(* ListPicker *)
ListPicker[Dynamic[x], CombinedList]
$\endgroup$

1 Answer 1

5
$\begingroup$

EDIT

As rasher observes my answer does not answer your direct question. Tooltip wrapper does not appear to work for ListPicker items. I posted this answer in the event it achieves your aim or motivates your own answer. I am not certain what your ultimate aim is.

I have modified your code (esp. avoid uppercase variable names to avoid conflicts with in-bulit functions):

itemList = {"Apples", "Oranges", "Bananas", "Watermelon"};
reviewsList = {"10 Reviews", "7 Reviews", "16 Reviews", "12 Reviews"};
tooltipList = {"5 Positive, 3 Neutral, 2 Negative", 
   "4 Positive, 1 Neutral, 2 Negative", 
   "10 Positive, 2 Neutral, 4 Negative", 
   "6 Positive, 3 Neutral, 3 Negative"};
combinedList = 
 Table[Tooltip[reviewsList[[i]], tooltipList[[i]], 
    BaseStyle -> {FontFamily -> "Verdana", FontSize -> 12}, 
    TooltipStyle -> Directive[24, Background -> LightRed]] -> 
   itemList[[i]], {i, 1, 4}]

Then using list picker:

Row[{ListPicker[Dynamic[x], combinedList, 
   BaseStyle -> {FontColor -> Purple, FontFamily -> "Verdana", 
     FontSize -> 12, FontWeight -> Bold}], "  ", Dynamic@First@x}, 
 Frame -> True]

yields:

enter image description here

Other answers may address the tooltips in dynamic interactive itemized lists.

$\endgroup$
5
  • $\begingroup$ Good answer, and probably the best the OP can hope for, since AFAIK, all such things (annotation, statusarea, tooltip, etc.) are not available on objects in ListPicker. +1 $\endgroup$
    – ciao
    Feb 24, 2014 at 9:32
  • $\begingroup$ @rasher thank you. I agree that, though desirable it may, tooltips do not work with items in list picker. However, I was unclear as to what was intended as label vs value. Just thought it might be useful to provide an example for motivation. $\endgroup$
    – ubpdqn
    Feb 24, 2014 at 9:37
  • $\begingroup$ I should have been more detailed in my post. The reason I wanted to to show the Tooltip in ListPicker was to not clutter the interface with too much information. The full version of my code has another submenu consisting of review summaries and picking a review from this submenu shows the review in full. I suppose I can show the total Positive, Neutral and Negative at the top of the submenu. Just thought that using the Tooltip would make the whole thing less cluttered. $\endgroup$
    – user12572
    Feb 24, 2014 at 10:46
  • $\begingroup$ @user12572 you know your aims. Your question was clear. I just was unclear about what final outcome you wished. I posted the answer as possible alternative that may suit or inspire. Other users may have workarounds the Tooltip for list items in ListPicker. I am not aware of any. Designing your own interface may not be "bang for (metaphorical) buck"... $\endgroup$
    – ubpdqn
    Feb 24, 2014 at 11:05
  • $\begingroup$ You could also choose to use a Mouseover to show the review details when the mouse rolls over the reviews display. $\endgroup$
    – m_goldberg
    May 18, 2014 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.