Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tablelist and focus

69 views
Skip to first unread message

Nicolas

unread,
Sep 17, 2015, 12:26:49 PM9/17/15
to
Hi Tablelist users...
a cell is displaying something....
when user double-click on the cell it opens a window (a toplevel one)
how can I tell to Tbalelist to lose the focus and give it to the new displayed toplevel?

I bind stuff like that:

bind [$tbl bodytag] <Double-ButtonPress-1> {
foreach {tablelist::W tablelist::x tablelist::y} [tablelist::convEventFields %W %x %y] break
if {![string equal [$tablelist::W containing $tablelist::x] 0]} {
set stepDef [string map {STEP ""} [$tablelist::W rowcget [$tablelist::W containing $tablelist::y] -name]]
switch [$tablelist::W columncget [$tablelist::W containingcolumn $tablelist::x] -name] {
chazeSeqTLink {
#THIS OPEN THE NEW TOPLEVEL
chazeSeqTLinkPage $stepDef
}
}
}
}


thanks for your help,
best regards,
Nicolas

Harald Oehlmann

unread,
Sep 17, 2015, 4:21:52 PM9/17/15
to
raise $TopLevel ?

nemethi

unread,
Sep 17, 2015, 4:55:13 PM9/17/15
to
The window manager will automatically set the input focus to the
toplevel widget created by your chazeSeqTLinkPage procedure. What you
probably want is to move the input focus to some descendant of that
toplevel (e.g., an entry or text widget). You can achieve this by
invoking the focus command from within chazeSeqTLinkPage, with that
descendant widget as argument.

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

Nicolas

unread,
Sep 17, 2015, 11:16:33 PM9/17/15
to
Hi Csaba, Salut Harald,
thanks for your answers.
it' obvious that the raise command should set the focus to the new toplevel, but strangely it doesn't

I had to put a break after [chazeSeqTLinkPage] it order to raise the toplevel...
bizarre...

best regards,
nicolas

Harald Oehlmann

unread,
Sep 18, 2015, 2:49:42 AM9/18/15
to
Nicolas,

great observation !
Typicall binding script issue ;-)

Maybee the Mega-Wizard Csaba may do something.

Merci,
Harald

Rich

unread,
Sep 18, 2015, 5:56:38 AM9/18/15
to
Nicolas <sl12...@gmail.com> wrote:
> Le jeudi 17 septembre 2015 22:55:13 UTC+2, nemethi a écrit :
> > Am 17.09.2015 um 18:26 schrieb Nicolas:
> > > Hi Tablelist users...
> > > a cell is displaying something....
> > > when user double-click on the cell it opens a window (a toplevel
> > > one) how can I tell to Tbalelist to lose the focus and give it to
> > > the new displayed toplevel?
> >
> > The window manager will automatically set the input focus to the
> > toplevel widget created by your chazeSeqTLinkPage procedure. What
> > you probably want is to move the input focus to some descendant of
> > that toplevel (e.g., an entry or text widget). You can achieve
> > this by invoking the focus command from within chazeSeqTLinkPage,
> > with that descendant widget as argument.
> >
> > --
> > Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

> it' obvious that the raise command should set the focus to the new
> toplevel, but strangely it doesn't

Raising a window to the top and giving that window focus are two
separate, independent, operations.

Many window managers (i.e., ms-windows) improperly conflate the two,
such that the window that is on top is also the window that receives
focus. But the actions of broken window managers does not change the
fact that the two operations are separate and independent operations.

That is why Tk has separate commands, because the functions are
actually separate functions. If you want the window to have focus, you
use the 'focus' command. If you want to raise the window, you use the
'raise' command. If you want both, you use both.

Nicolas

unread,
Sep 18, 2015, 9:14:59 AM9/18/15
to
Hi Rich,
you're right, I should have written:
"how can I raise a toplevel freshly created thanx to a tableList bind"

++

Rich

unread,
Sep 18, 2015, 3:54:01 PM9/18/15
to
If you want to raise it, use 'raise'. If you want focus to shift to
it, use 'focus'. If you want it to both raise and be focused, use both
'raise' and 'focus'.

nemethi

unread,
Sep 18, 2015, 3:57:47 PM9/18/15
to
Do the Tablelist demo scripts embeddedWindows.tcl and
embeddedWindows_tile.tcl work for you as expected? Does the toplevel
widget created by a mouse click into the column "View" appear in raised
state (i.e., on top of the window hierarchy)?

Nicolas

unread,
Sep 19, 2015, 5:46:30 AM9/19/15
to
Hi Csaba,
raising works as expected in another tablelist of the program...
but for this particular binding it doesn't without the break

best regards,
nicolas

nemethi

unread,
Sep 19, 2015, 7:09:13 AM9/19/15
to
To test this, I have added a similar <Double-ButtonPress-1> binding to a
copy of the demo script embeddedWindows.tcl. The modified script
(without the break!) works for me as expected: the toplevel widget
appears in raised state (i.e., on top of the window hierarchy). What is
different in your case?

As always, a simple standalone script enabling us to reproduce your
problem, together with some platform-related information would be helpful.
0 new messages