• Cef 重写alert与confirm弹窗


     在使用form内嵌cef浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录。所以想起来重写alert的样式,通过MessageBox进行提示,或者自己写一个弹窗。

    以下代码基于 3.2623.1401.gb90a3be 也就是最后一个兼容xp的版本

    procedure Tfrm.Chromium1Jsdialog(Sender: TObject;
      const browser: ICefBrowser; const originUrl, acceptLang: ustring;
      dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring;
      callback: ICefJsDialogCallback; out suppressMessage, Result: Boolean);
    var
     m: ustring;
    begin
      inherited;
    
      case dialogType of
        JSDIALOGTYPE_ALERT:
        begin
          GLB.ShowMsgBoxWarning(messageText, defaultPromptText);
          suppressMessage:=True;
          Result:=False;
        end;
        JSDIALOGTYPE_CONFIRM:
        begin
          callback.Cont(GLB.ShowMsgBoxQuery(messageText, defaultPromptText)=mrYes, m);
          suppressMessage:=False;
          Result:=True;
        end;
    //    JSDIALOGTYPE_PROMPT: //输入框;
      end;
    end;
  • 相关阅读:
    API连接显示
    zabbix基本介绍
    JMX类型监控
    zabbix sender
    监控项的获取
    zabbix值显示的问题
    windows客户端
    gj的zabbix客户端开机自启动设置
    TCP/UDP
    内置宏
  • 原文地址:https://www.cnblogs.com/h2285409/p/10535330.html
Copyright © 2020-2023  润新知