[英]Access violation if i try to change the ribbon style using a TRibbonCombobox
i get an Access Violation if i try to change the ribbon style using a TRibbonCombobox. 如果尝试使用TRibbonCombobox更改功能区样式,则会收到访问冲突。
then, i modified the delphi ribbon demo to provide a combobox method to set the style: 然后,我修改了delphi功能区演示,以提供组合框方法来设置样式:
here is the event code: 这是事件代码:
procedure TfrmRibbonDemo.RibbonComboBox1Change(Sender: TObject);
begin
if RibbonComboBox1.Text='Luna' then
Ribbon1.Style:=RibbonLunaStyle
else
Ribbon1.Style:=RibbonSilverStyle;
end;
when i change the style (especially more than once) with the TRibbonCombobox, i get: 当我使用TRibbonCombobox更改样式(尤其是多次更改)时,我得到:
date/time : 2009-10-02, 11:11:29, 843ms
operating system : Windows XP Service Pack 3 build 2600
physical memory : 583/2047 MB (free/total)
free disk space : (C:) 71.72 GB
display mode : 1280x1024, 32 bit
allocated memory : 23.59 MB
executable : RibbonDemo.exe
exec. date/time : 2009-10-02 11:11
compiled with : Delphi 2009
madExcept version : 3.0k
exception class : EAccessViolation
exception message : Access violation at address 0054767C in module 'RibbonDemo.exe'. Read of address 0000005F.
main thread ($ed0):
0054767c +054 RibbonDemo.exe RibbonActnCtrls TCustomRibbonComboBox.SetBounds
00546e52 +0a2 RibbonDemo.exe RibbonActnCtrls TRibbonComboControl.SetBounds
00516f39 +0f1 RibbonDemo.exe ActnMan TCustomActionControl.CalcBounds
0051853d +005 RibbonDemo.exe ActnCtrls TCustomButtonControl.CalcBounds
00546482 +00a RibbonDemo.exe RibbonActnCtrls TRibbonComboControl.CalcBounds
00516754 +030 RibbonDemo.exe ActnMan TCustomActionControl.SetSpacing
0051a243 +01b RibbonDemo.exe ActnCtrls TCustomActionToolBar.CreateControl
00557f16 +01a RibbonDemo.exe Ribbon TCustomActionControlBar.CreateControl
0056205a +006 RibbonDemo.exe Ribbon TCustomRibbonGroup.CreateControl
0051243f +087 RibbonDemo.exe ActnMan TCustomActionBar.CreateControls
00519b35 +005 RibbonDemo.exe ActnCtrls TCustomActionDockBar.CreateControls
0051a2c6 +022 RibbonDemo.exe ActnCtrls TCustomActionToolBar.CreateControls
00557fcb +027 RibbonDemo.exe Ribbon TCustomActionControlBar.CreateControls
00562075 +005 RibbonDemo.exe Ribbon TCustomRibbonGroup.CreateControls
00514542 +05e RibbonDemo.exe ActnMan TCustomActionBar.RecreateControls
0050e081 +04d RibbonDemo.exe ActnMan TCustomActionManager.SetStyle
0055dac3 +02f RibbonDemo.exe Ribbon TCustomRibbon.SetStyle
0056720c +04c RibbonDemo.exe RibbonDemoMainForm 387 +3 TfrmRibbonDemo.RibbonComboBox1Change
if i make a style change with a button on the ribbon bar, it works fine. 如果我通过功能区栏上的按钮进行样式更改,则效果很好。
thank you for your help! 谢谢您的帮助!
You are modifying the styles of the ribbon, which also modifies the combobox that triggers the event. 您正在修改功能区的样式,这也将修改触发事件的组合框。
In order for this to work, a programming interface must be "re-entrant", and the ribbon system obviously isn't. 为了使它起作用,编程接口必须是“可重入的”,而功能区系统显然不是。
There are several possible solutions: 有几种可能的解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.