Hi
I have setup a tooltip for a gtkview (liststore) in gtk3-perl
It all works fine except if there is no tooltip text an ugly black rectangle shows up. Is there a way to hide this.
$widgete{controlview}->signal_connect('query-tooltip'=>sub{
($sopts->{view},$sopts->{xpos},$sopts->{ypos},$sopts->{key},$sopts->{tooltip})=@_;
$sopts->{colh}=\%colh;
encode_gui_tooltip($sopts);
return 1;
}
);
sub encode_gui_tooltip {
my ($sopts)=@_;
my ($view,$xpos,$ypos,$key,$tooltip)=
($sopts->{view},$sopts->{xpos},$sopts->{ypos},$sopts->{key},$sopts->{tooltip});
my ($bin_x, $bin_y) = $view->convert_widget_to_bin_window_coords($xpos, $ypos);
my @path = $view->get_path_at_pos($bin_x,$bin_y);
my ($row,$colno);
if ($path[0]){
$row=$path[0]->to_string;
}
if ($path[1]){
$colno=$sopts->{colh}->{$path[1]->get_title};
}
$actions{2}->{3}->{cmd}=sub{
#elsif ($colno==3){
my $option;
$option=$sopts->{controlmodel}->get($sopts->{controlmodel}->get_iter_from_string(2),3);
if (!($option )){
$option=q{}
}
$tooltip->set_text($option);
$view->set_tooltip_cell($tooltip, $path[0], $path[1])
};
if ($actions{$row}->{$colno}->{cmd}){
&{$actions{$row}->{$colno}->{cmd}}
}
else {
no warnings ;
#my $tooltip=undef;
$tooltip->set_custom(undef);
#$tooltip->set_text(undef);
#$tooltip->set_icon(undef);
#$view->set_tooltip_cell(undef);
#$view->set_tooltip_cell($tooltip, $path[0], $path[1]);
return 0
};
As can be see I’ve tried various approaches so far with no success. Setting tooltip to undef works but spews out loads of messages from Glib::Introspection
unhandled exception in callback:
*** undef is not of type Gtk3::Tooltip at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 67.
*** ignoring at /usr/share/perl5/vendor_perl/Gtk3.pm line 572.