Focus problem with dialog box 'configured' as a Label Entry widget.
"Henry Merryweather" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <000001c5b911$893212f0$0200a8c0@eveshampc> |
I am using the following to create a dialog box (following code in
Mastering Perl Tk - page 565).
$db = $main::mw_Main->DialogBox(
-title => $dl_title,
-buttons => ['OK']);
$db->add('LabEntry',
-textvariable
=> \$dm_entry,
-width
=> $dl_width,
-label
=> $dl_label,
-labelPack
=> [-side => 'left'])
#A
->pack;
#B
#C
$answer = $db->Show();
This works fine except that you have to use the mouse or something
similar to get the cursor in the window in which you type the required
data.
It would be better if the focus was already there.
I have tried:
1. adding $db->focus; at #B
2. $db->focus: at #B with $db->focus at #A
3. $db->bind('<Enter>' => [$db, 'Tk::focus']); at #C - this was
follwoing a succesful answer to a focus problme I had wioth a canvas.
However, none of these gave the desired result.
How can I get the focus in the widget when it is opened?
Best regards
Henry Merryweather