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

solution for regaining focus from OpTcl hosted ActiveX control

13 views
Skip to first unread message

Rob Hegt

unread,
Mar 1, 2002, 8:32:04 AM3/1/02
to
Last week I posted a question about how to regain focus
from an ActiveX control that was hosted by an Optcl window.
Alexander Nosenko was kind enough to send me a Tk core
patch that would solve the apparently known issue.

However, I set myself on another trail after sending a reply
to another thread, which involved yet another extension, ffidl.
Using ffidl I have been able to solve my problem, and I
would like to present my solution here. It is based on the info
Alexander put in his patch file.

Here is a little test script (note: you will need OpTcl and Ffidl
in the lib subdirectory):

-----------------------------------------------------
load lib/optcl.dll
load lib/ffidl05.dll

ffidl::callout dll_SetFocus {int} int [ffidl::symbol user32.dll SetFocus]

proc GrabFocus {args} {dll_SetFocus [winfo id .]}

canvas .main
optcl::new -window .main.h "file:///[pwd]/index.htm"
.main create window 0 0 -anchor nw -window .main.h

entry .entry1
entry .entry2

pack .main .entry1 .entry2

bind . <Button> +GrabFocus
-----------------------------------------------------

You should also create the index.htm file, with e.g. the following content:

-----------------------------------------------------
<html>
<head>
</head>
<body>
<input type="text">
</body>
</html>
-----------------------------------------------------

If you now type something in the HTML input box, and next click in either
one of the entries, the selected entry will get the keyboard focus.

To see the original problem, just comment the last line in the script, and try
again.

Maybe this will be of help to someone!
Rob Hegt


0 new messages