#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11118320 use warnings; # my first pTk-MEGAWIDGET: I developed the code. It was widgetized by a "perl monk" use Tk; # THIS THING WORKS!! { # for package package Tk::GUIask; use List::Util qw( first ); use base qw/ Tk::Frame /; # Frame-based composite Construct Tk::Widget 'GUIask'; # install MyNewWidget in pTk namespace sub ClassInit # called once to initialize new class { my($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate # called to build each widget instance { my($self, $args) = @_; $self->SUPER::Populate($args); my $search = ''; my $frame = $self->Frame( -borderwidth => 5, -relief => 'ridge', )->pack(-fill=> 'both', -expand=> 1); my $label = $frame->Label( -fg => 'blue', -font => 30, )->pack(-fill => 'x'); my $lbox; my $entry = $frame->Entry( -textvariable => \$search, -validate => 'key', )->pack(-fill => 'x'); # my $button = $frame -> Button( # -text => "Abort", # -bg => 'red', # -command => sub { # #$mw -> destroy(); # ($frame -> destroy() ) if Tk::Exists($frame ); # } # ) ->pack(-fill => 'x' ); $self->ConfigSpecs( DEFAULT => [$lbox], text => [$label] ); $self->Delegates( Construct => $lbox, insert => $lbox ); } } # CLOSE package