Hello,

I would like to enhance the widget Tk::Entry by some features (without putting a frame around) and for a first quich hack I wrote something like

package Tk::Widget; use Tk::Entry; # ... sub MyEntry { # construcor # ... my $entry = $parent->Entry(.....); }

(code shortened to the essentials) which seems to work, but doesn't look too pretty in my eyes.

Well, then I found out about Tk::Widget and tried something like

package Tk::MyEntry; require Tk::Widget; use base qw(Tk::Entry); Construct Tk::Widget 'MyEntry'; # ...

which gave me the following errormessage that this way can only be used with Widgets based on Tk::Frame

Can't locate object method "Construct" via package "Tk::Widget" at ... +Tk/Frame.pm line 13...

Well, then I searched the books Mastering Perl/Tk and Learning Perl/Tk, but didn't find anything helpful in this case, and all the widget's sourcecode I found was based on a frame.

Please, could you give me a hint on how to inherit from Tk::Entry properly?

(Btw: on CPAN there is no module with the same features, and I'd like to share this module with others when it is finished)

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"


In reply to "Official way" to inherit from Tk::Entry by strat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.