VCLSkin可能存在的一个bug隐患
来源:互联网 发布:网络电视的电视猫 编辑:程序博客网 时间:2024/04/28 22:50
产生bug的情况:
1, 使用Tab键切换焦点在Button上,按空格键执行按钮事件时
2, 焦点在RadioButton上,按任意字母时
bug错误现像:地址错误
环境: VCLSkin 4.9.1, Win 2003 Ent Sp2, Delphi 7.0
WinSkinForm.pas中代码段:
//fixed by Brian Lowe
procedure TWinSkinForm.CMDialogChar(var Message: TMessage); //TCMDialogChar
var
Button: TMenubtn;
ShiftState: TShiftState;
KeyState: TKeyboardState;
begin
OldWndProc(message);
if message.result<>0 then exit;
GetKeyboardState(KeyState);
ShiftState := KeyboardStateToShiftState(KeyState);
Button := FindButtonFromAccel(TWMKey(Message).CharCode);
if (Button <> nil) and (ShiftState = [ssAlt]) then begin
clickbutton(button);
Message.Result := 1;
done2:=true;
end else begin
//mdiform mainmenu shortcut
if (formstyle=sfsmdichild) then begin
if skinmanager.MDIForm.Perform(CM_DIALOGCHAR,
TWMKey(Message).CharCode,TWMKey(Message).KeyData)<>0 then exit;
end else if (fform<>application.MainForm) and (not (fsModal in fform.FormState)) then begin //has problem
application.MainForm.Perform(CM_DIALOGCHAR,TWMKey(Message).CharCode,TWMKey(Message).KeyData); [注1]
end;
message.Result:=0;
// OldWndProc(message);
end;
end;
本想写个示例程序,但新建的示例程序怎么也不出现错误.
比如幸运的时, 作者在写这部分代码时,有一行注释:mdiform mainmenu shortcut, 现在没时间去追根问底, 对于这一行注释, 猜测这是针对MDI窗口的代码, 所以,有一种情况是:一直在执行[注1]处代码, 为了避免这种隐患, 加一行代码或许更好些(下面代码粗体部分).
//fixed by Brian Lowe
procedure TWinSkinForm.CMDialogChar(var Message: TMessage); //TCMDialogChar
var
Button: TMenubtn;
ShiftState: TShiftState;
KeyState: TKeyboardState;
begin
OldWndProc(message);
if message.result<>0 then exit;
GetKeyboardState(KeyState);
ShiftState := KeyboardStateToShiftState(KeyState);
Button := FindButtonFromAccel(TWMKey(Message).CharCode);
if (Button <> nil) and (ShiftState = [ssAlt]) then begin
clickbutton(button);
Message.Result := 1;
done2:=true;
end else if (Application.MainForm <> nil) and (Application.MainForm.FormStyle = fsMDIForm) then begin
//mdiform mainmenu shortcut
if (formstyle=sfsmdichild) then begin
if skinmanager.MDIForm.Perform(CM_DIALOGCHAR,
TWMKey(Message).CharCode,TWMKey(Message).KeyData)<>0 then exit;
end else if (fform<>application.MainForm) and (not (fsModal in fform.FormState)) then begin //has problem
application.MainForm.Perform(CM_DIALOGCHAR,TWMKey(Message).CharCode,TWMKey(Message).KeyData);
message.Result:=0;
end;
// OldWndProc(message);
e
1, 使用Tab键切换焦点在Button上,按空格键执行按钮事件时
2, 焦点在RadioButton上,按任意字母时
bug错误现像:地址错误
环境: VCLSkin 4.9.1, Win 2003 Ent Sp2, Delphi 7.0
WinSkinForm.pas中代码段:
//fixed by Brian Lowe
procedure TWinSkinForm.CMDialogChar(var Message: TMessage); //TCMDialogChar
var
Button: TMenubtn;
ShiftState: TShiftState;
KeyState: TKeyboardState;
begin
OldWndProc(message);
if message.result<>0 then exit;
GetKeyboardState(KeyState);
ShiftState := KeyboardStateToShiftState(KeyState);
Button := FindButtonFromAccel(TWMKey(Message).CharCode);
if (Button <> nil) and (ShiftState = [ssAlt]) then begin
clickbutton(button);
Message.Result := 1;
done2:=true;
end else begin
//mdiform mainmenu shortcut
if (formstyle=sfsmdichild) then begin
if skinmanager.MDIForm.Perform(CM_DIALOGCHAR,
TWMKey(Message).CharCode,TWMKey(Message).KeyData)<>0 then exit;
end else if (fform<>application.MainForm) and (not (fsModal in fform.FormState)) then begin //has problem
application.MainForm.Perform(CM_DIALOGCHAR,TWMKey(Message).CharCode,TWMKey(Message).KeyData); [注1]
end;
message.Result:=0;
// OldWndProc(message);
end;
end;
本想写个示例程序,但新建的示例程序怎么也不出现错误.
比如幸运的时, 作者在写这部分代码时,有一行注释:mdiform mainmenu shortcut, 现在没时间去追根问底, 对于这一行注释, 猜测这是针对MDI窗口的代码, 所以,有一种情况是:一直在执行[注1]处代码, 为了避免这种隐患, 加一行代码或许更好些(下面代码粗体部分).
//fixed by Brian Lowe
procedure TWinSkinForm.CMDialogChar(var Message: TMessage); //TCMDialogChar
var
Button: TMenubtn;
ShiftState: TShiftState;
KeyState: TKeyboardState;
begin
OldWndProc(message);
if message.result<>0 then exit;
GetKeyboardState(KeyState);
ShiftState := KeyboardStateToShiftState(KeyState);
Button := FindButtonFromAccel(TWMKey(Message).CharCode);
if (Button <> nil) and (ShiftState = [ssAlt]) then begin
clickbutton(button);
Message.Result := 1;
done2:=true;
end else if (Application.MainForm <> nil) and (Application.MainForm.FormStyle = fsMDIForm) then begin
//mdiform mainmenu shortcut
if (formstyle=sfsmdichild) then begin
if skinmanager.MDIForm.Perform(CM_DIALOGCHAR,
TWMKey(Message).CharCode,TWMKey(Message).KeyData)<>0 then exit;
end else if (fform<>application.MainForm) and (not (fsModal in fform.FormState)) then begin //has problem
application.MainForm.Perform(CM_DIALOGCHAR,TWMKey(Message).CharCode,TWMKey(Message).KeyData);
message.Result:=0;
end;
// OldWndProc(message);
e
- VCLSkin可能存在的一个bug隐患
- 解决vclskin可能存在的bug
- 浏览器中可能存在的bug
- VCLSkin 4.12 FullSource的bug修正
- VCLSkin 4.12 FullSource的bug修正
- 解决strncpy存在的隐患
- 一个可能存在Bug的二分查找方法的实现,大家一起看看有什么问题没
- 使用EventListener为Element 捕获焦点可能存在的BUG
- 可能是 ID3DXSprite 的一个bug。
- 可能是ReadFile的一个Bug
- 发现apache的mod_python存在一个BUG
- ASP.NET虚拟主机存在的重大隐患
- ASP.NET虚拟主机存在的重大隐患
- linux Socket编程存在的隐患
- 思路不缜密,错写一个词,带来很隐患的bug
- matlab variables 窗的一个可能的bug
- 自己写的一个链表,可能有bug
- EJS前端版的一个小问题,可能是bug.
- new之后发生了什么?
- 在JTable中按回车键焦点水平移动
- cctv主持当医生
- H323端口开放一览表
- 谁将获得区号026?
- VCLSkin可能存在的一个bug隐患
- Java对象持久化技术Hibernate 一
- 封送处理您的数据:利用 COM 和 Windows 2000 的高效传输数据的技术
- 用CfileFind递归搜索目录
- 影响SQL server性能的关键
- Today is my birthday!
- 正则表达式符号及特殊字符一览
- showModalDialog()、showModelessDialog()方法使用详解
- 田黄石的识别