I found a solution but I don't like it...
It turns out that Tk::stayOnTop uses the -topmost attribute of the Tk window if it's available. Otherwise, it uses the Win32::API module to mess around with the window properties.
As you will see below, I figured that I could set the window to be out of topmost mode when in focus and out of topmost when in focus. The problem is that when using the topmost attribute approach the window goes out of focus so the user would not be typing in the box anymore. If one comments out the line that checks for the topmost attribute in Tk::StayOnTop then it forces it to use the Win32::API functions and then everything works. Obviously this fix would not work with linux but I do not know if the problem existed in linux.
To get this code to work one must uncomment the following line from Tk::StayOnTop(version 0.12/line 58)
return METHOD_ATTRIB if $Tk::VERSION >= 804.027;I will probably just implement the API calls that Tk::StayOnTop implements so then I can actually send this to others, but should I report this as a bug? and if so then what would this be a bug in?
use Tk; require Tk::StayOnTop; require Tk::MatchEntry; $desc = ""; @opts = ("test","one","two","three"); $window = MainWindow->new; $window->Button(-text => "Button")->grid(-row=>1,-column=>0); $Entry = $window->MatchEntry(-textvariable => \$desc, -listcmd=>\&move +List)->grid(-row=>0,-column=>0); $Entry->choices(\@opts); $window->after(1000,sub {$window->stayOnTop()}); $window->bind('<FocusOut>', \&focusOut); MainLoop; sub moveList { if($lowered == 0) { $window->dontStayOnTop(); $lowered = 1; } } sub focusOut { if($lowered == 1) { $window->stayOnTop(); $lowered = 0; } }
In reply to Re: Help preventing Tk::StayOnTop from hiding Tk::MatchEntry pop up list
by imbeyondboredom
in thread Help preventing Tk::StayOnTop from hiding Tk::MatchEntry pop up list
by imbeyondboredom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |