From: Mike S. <MikeSchroeder@DonorWare.com> - 2004-05-05 18:11:27
|
I am trying to get the Tooltip over a ListCtrl to change based on what item is selected (or ideally hovered over, but I'll settle for selected). (I want to show extended information on the row without requiring a right-click-->popup_menu-->dialog sequence). Currently, it works, but with mixed results: 1) First time in, the tooltip shows up and displays value for first item 2) Select a different item, no tooltip 3) move mouse to different part of window (off the ListCtrl) 4) move mouse back over ListCtrl, tooltip now shows text for the item selected in step 2. Is there a method I could be using to "reset" focus (like moving mouse off and back on)? I tried using SetFocus() on the list control after setting the tool tip with no effect. Is there a better way to do this? (or is this another of my dumb obvious questions that I am just not seeing the answer too ;^). --- code follows --- EVT_LIST_ITEM_FOCUSED( $self, $self->{featured_list_ctrl}, \&OnFeaturedFocused); sub OnFeaturedFocused { my ( $self, $event ) = @_; my $listctrl = $self->{featured_list_ctrl}; my $eventitem = $event->GetItem; my $itemindex = $event->GetIndex; my $realitem = $listctrl->GetItem( $itemindex ); unless ( $realitem->GetText eq $eventitem->GetText ) { carp "Unexpected"; } else { $listctrl->SetToolTipString("Tooltip for " . $realitem->GetText ); } } |