jruff has asked for the wisdom of the Perl Monks concerning the following question:

I have a BrowseEntry widget that populates a Entry widget using the browsecmd.
$addRefdesListbox = $addRefdesFrame2->BrowseEntry(-variable=>\$sear +chString, -fg=> 'black', -bg=> 'white', -exportselection => 0, -browsecmd => sub{$addRefdesEntry->insert('end',$refdesMaxValue{$searc +hString}+1)}, -listcmd=> \&doSearch, )->pack(-side=>'left');

If I change contents of the Entry widget {$addRefdesEntry}, I loose my reference to the BrowseEntry widget as shown when I try to do the following later in the program.

$refdesListbox->see($addRefdesListbox->Subwidget('slistbox')->curselec +tion());

The $addRefdesListbox->Subwidget('slistbox')->curselection() value is null if I edit the Entry widget. This yields the following error.

Tk::Error: wrong # args: should be ".toplevel.frame.frame.frame.frame. +frame1.frame.listbox see index" at C:/Perl/site/lib/Tk.pm line 228. Tk callback for .toplevel.frame.frame.frame.frame.frame1.frame.listbo +x [\&tepsTools::__ANON__] (menu invoke)

If I do not edit the Entry widget, program runs fine.

I would appreciate any insight into this. Thanks

20050317 Edit by ysth: code tags

Replies are listed 'Best First'.
Re: BrowseEntry browsecmd causes error
by zentara (Cardinal) on Mar 18, 2005 at 14:55 UTC
    You should try to make a simple working code example which demonstrates your problem, and repost your question. It's hard for us to see a problem, without some code to run.

    Just guessing: Maybe when you edit the Entry, you loose focus on the Listbox? Or maybe you need to run a $mw->update after editing the Entry? Are you using textvariables? Maybe it's a windows-specific problem. Try -exportselection=>1 ??


    I'm not really a human, but I play one on earth. flash japh
      Thanks for your comments. It would be difficult to model the issue, because It uses three modules and two graphic screens. I did not use textvariables, just tried to reference the widget directly. I also tried exportselection. I believe that some garbage clean up between subs are the issue. Thanks for the response, I reexamined my logic and removed the BrowseEntry widget and used the Entry Widget. Again thanks for the response.