Hi there! I'm developing a module to simplify Gtk2 widgets for rapid GUI development in my project (Fvwm-Nightshade).
I do it with the Gtk2::Fixed container because of the xy positioning possibility. A widget call looks like this: #$win->add_button( Name => 'closeButton', # Position => [310, 350], # Size => [80, 40], # Title => 'Close', # Tooltip => 'Blafasel'); Now to my problem. Some of the widgets have a tooltip function but not all. For those I use Gtk2::tooltips but run into the problem, that the tooltip won't show or only at the borders of a widget. Does anybody know what's wrong? I've created the tooltips object in my window class: ## new Window ( Type => <type> <= supported window types: toplevel, popup ## Name => '<name>' <= must be unique ## Title => '<window title> ## Width => width <= otional ## Height => height) <= otional #sub new_window ($@) { # my $class = shift; # my %params = @_; # my $window; # my $self = {}; # $self->{objects} = {}; # $self->{groups} = {}; # $self->{type} = $params{'Type'}; # $self->{name} = $params{'Name'}; # $self->{title} = $params{'Title'}; # $self->{width} = $params{'Width'} || undef; # $self->{height} = $params{'Height'} || undef; # $self->{tooltips} = Gtk2::Tooltips->new(); # $self->{tooltips}->enable; # bless $self, $class; # # # create the window # $window = new Gtk2::Window($self->{type}); # $window->set_title($self->{title}); # $self->{window} = $window; # # # add signal handler # $self->add_signal_handler($self->{name}, "destroy", sub {Gtk2->main_quit;}); # # # add geometry if defined # if ($self->{width} && $self->{height}) { # $window->set_default_size($self->{width}, $self->{height}); # } # # # Create the fixed container # my $fixed = new Gtk2::Fixed(); # $self->{container} = $fixed; # $self->{window}->add($fixed); # # return $self; #} In a widget e.g. a radio button: ## add_radio_button( Name => <name>, <= Name of the button. Must be unique ## Position => [pos_x, pos_y], ## Title => <title>, ## Group => <button_group>, <= Name of the buttongroup. Must be unique ## Active => 0/1 <= Which is the active button. Default is 0 (not active) ## Underlined => 0/1, <= Optional ## Tooltip => <tooltip-text>) <= Optional ## ) #sub add_radio_button($@) { # my $self = shift; # my %params = @_; # my $object = new_widget(%params); # $object->{type} = 'RadioButton'; # # # radio button specific fields # $object->{group} = $params{'Group'} || undef; # $object->{active} = $params{'Active'} || 0; # $object->{underline} = $params{'Underline'} || 0; # $object->{tooltip} = $params{'Tooltip'} || undef; # # # create radio button # my $radio_button; # # # get the group # my $group = exists($self->{groups}->{$object->{group}}) ? $self->{groups}->{$object->{group}} : undef; # # get the last widget from @group # my $last = defined($group) ? @$group[-1] : undef; # # # if underline in text should use # if ($object->{underline}) { # $radio_button = Gtk2::RadioButton->new_with_label_from_widget ($last, $object->{title}); # $radio_button->set_use_underline(TRUE); # } else { # $radio_button = Gtk2::RadioButton->new_with_label($last, $object->{title}); # } # # # Check if tooltip should use # if (defined($object->{tooltip})) { # $self->{tooltips}->set_tip ($radio_button, $object->{tooltip}); # } # # # set radio button active # $radio_button->set_active(TRUE) if $object->{active}; # # # add group to window groups list # unless (defined($group)) { # $group = $radio_button->get_group(); # $self->{groups}->{$object->{group}} = $group; # } # # # positon of the radio button # $self->{container}->put($radio_button, $object->{pos_x}, $object->{pos_y}); # # # add widget object to window objects list # $object->{obj_ref} = $radio_button; # $self->{objects}->{$object->{name}} = $object; #} Hope anybody can help else I have to remove the tooltips what would be a pitty ... Thanks in advance, Thomas -- -- "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." -- Albert Einstein _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-perl-list