The following program creates a FrameWnd with an
Edit control in it.

If I select some text in the control, then switch
to another window and back again, the Edit control
has lost the keyboard focus.

Normal Windows applications don't behave that way.
What do I have to do to get my controls to stay
focused?

#--------------------------------------------------------------

import os, win32con as wc, win32ui as ui, win32gui as gui

class Test(object):

  def __init__(self):
    frame = ui.CreateFrame()
    self.frame = frame
    frame.CreateWindow(None, "Test Focus",
      wc.WS_CAPTION | wc.WS_SYSMENU, (100, 100, 300, 200))
    frame.AttachObject(self)
    edit = ui.CreateEdit()
    edit.CreateWindow(wc.WS_VISIBLE, (10, 10, 90, 30),
      frame, 1)
    frame.ShowWindow()

  def OnClose(self):
    gui.PostQuitMessage(0)

test = Test()
app = ui.GetApp()
app.Run()

#--------------------------------------------------------------

--
Greg
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to