delphi – 如何使RibbonApplicationMenuBar处于非活动状态/活动状态?

我尝试了许多与RibbonApplicationMenuBar相关联的方法,以防止用户使用鼠标选择RibbonApplicationMenuBar,直到从inifile加载项目设置并关闭splashform.但除非另有说明,否则似乎没有任何工作可以使RibbonApplicationMenuBar InActive.

帮助文件没有显示RibbonApplicationMenuBar的许多属性和帮助Wiki相同,所以我无法解决这个问题.

procedure TMainForm.FormCreate( Sender: TObject );
begin
  // make theRibbonApplicationMenuBar1 inactive
  RibbonApplicationMenuBar1.Enabled := False;
  RibbonApplicationMenuBar1.Inactive := True;
  RibbonApplicationMenuBar1.Hide;
  RibbonApplicationMenuBar1.AutoFocus := False;
  // read application settings
  ReadIni( AIniFileFilename );
  // show a splash form
  FormSplash := TFormSplash.Create( MainForm );
  // FormSplash.Parent := MainForm;
  FormSplash.Position := poOwnerFormCenter;
  FormSplash.Show;
  FormSplash.Update;
end;


procedure TMainForm.FormShow( Sender: TObject );
begin
  // close the splash form
  FormSplash.RequestClose;
  // Activate the RibbonApplicationMenuBar
  RibbonApplicationMenuBar1.Enabled := True;
  RibbonApplicationMenuBar1.Inactive := False;
  if RibbonApplicationMenuBar1.CanFocus then
    RibbonApplicationMenuBar1.SetFocus;
  RibbonApplicationMenuBar1.AutoFocus := True;
  RibbonApplicationMenuBar1.SelectApplicationButton;
  RibbonApplicationMenuBar1.Show;
end;

除非RibbonApplicationMenuBar处于非活动状态,否则用户可以在准备好选择之前选择RibbonApplicationMenuBar.任何建议表示赞赏.我知道这里显示的所有方法都不正确或可能无序…这只是我试图阻止RibbonApplicationMenuBar变为活动和可点击,直到启动窗体关闭.

谢谢,

法案

最佳答案
只需将TRibbon.Enabled设置为False即可禁用所有功能区操作(使用XE3测试).
最简单的方法是在设计时将其设置为假.将其设置为True,例如从您的启动表单的OnHide中设置.仅在完成所有后台活动时关闭启动.

转载注明原文:delphi – 如何使RibbonApplicationMenuBar处于非活动状态/活动状态? - 代码日志