我用toolbar2000的TTBToolWindow控件作了一个控制栏,mdi子窗口为一dbgrid控件,当控制栏的edit窗口拥有焦点时,mdi子窗口的dbgrid控件无法得到焦点,怎么解决?
解决方案 »
- DBLookupComboBox怎么使用?
- 路过的人帮忙看看呀
- 菜鸟的一个小问题?~~~~~~~~~~在线等(马上给分)
- 我想得到一个串值的最后一个值,该怎么做、
- picklist问题
- 添加一条记录,在三天之内可以修改,过三天后不能修改此记录.
- 顯示資料庫中的圖片時提示.jpeg error #52,找了許多以前的覘子都是一樣的,100分,code見內
- 连接SQLServer2008连不上...求救...
- 软件原理???????????????????????????????????????????????????????????????????
- 关于QUERY的问题???????
- 烦烦烦~ 问斑猪以及各位 —— 我是murphy
- 请帮忙看一段代码?
Product:Delphi all versions
Uploader: Fernando Silva
Question/Problem/Abstract:
How to control focus in a MDI application?
Answer:Status: MDI-application. MDI window and one child window. MDI window owns a
TPanel component, which owns any component which can get focus (TEdit for example).
Child window owns a TDBGrid component.
Problem: After running this simple test application, the focus is set on child
window's first focusable component - TDBGrid. After switching focus to TEdit
component owned by MDI window, there is no more possibility to switch focus back
to TDBGrid component owned by child window. TDBGrid component is immune to any
mouse events. Why? It looks like a child window is thinking about still having
focus. This is one of the many shortcomings of the Windows MDI framework, it has never
been designed to cope with controls outside the MDI children that can take the
focus. You can trick it by sending a WM_MDIACTIVATE message to the active MDI
child, here demonstrated by an OnClick handler for a combobox on the toolbar: procedure TMainForm.ComboBox1Click(Sender: TObject);
begin
{ ... other actions }
if Assigned( ActiveMDIChild ) then
with ActiveMDIChild do
sendmessage( handle, wm_mdiactivate, 0, handle );
end; 谁有更好的办法