Alright!

While Im working on this, I was hoping maybe someone here has any good idea on this. Ok, Im doing some nice app here in perl and it uses mySQL db. Now, I've set a window's repeat to like 2 seconds, and the basic idea here is that its supposed to show up result from the mySQL db just beneath an Entry (Tk) widget (kinda like autocompletion) when user types something in the entry. So far I've done something like this:
$fastSearchMenu = $mw->Menu(-tearoff => 0); foreach my $row (@$tbl_array_ref) { $fastSearchMenu->add ('command', -label=> $row->{'path'}, -command => sub { } ); } #$menu->add('separator'); $fastSearchMenu->Popup(-popover => 'cursor'); #$fastSearchMenu->Post(300, 300); $full_PathEntry->focus();
However, this isnt really as nice as I want it. First off, I loose focus from the Entry (eventhough I do the ->focus thingy). And the old meny is floating and doesnt disapear (what its supposed to do, when the db data is updated as user types something else or so). It's also supposed to work pressing.. say.. down arrow on keyboard, and then be able of selecting from this "menu".

So, anyone here got some kewl ideas how to implement this smoothly, and make it work properly? Quite tricky... Not even sure if I should use ->Post or ->Popup either... Or maybe I should use something totally different than Tk::Menu?

Thanks,
Ace

In reply to Autocompletion simulated in Tk by Ace128

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.