【轉】如何在html與delphi間互動代碼

來源:互聯網
上載者:User

標籤:

【轉】如何在html與delphi間互動代碼 (2015-11-19 22:16:24) 轉載▼
標籤: it 分類: uniGUI
uniGUI總群中 台中cmj朋友為我們總結了如下內容,對於利用delphi+uniGUI開發應用,可以說是精品,必須掌握。
一句話,如何在html與delphi間互動代碼,是最好的答案。

[ClientEvents操作]
Js存取Edit,Memo元件值getValue,setValue
    MainForm.Edit1.setValue(“ABCDE”); //把值設定給Edit1
    Ext.getCmp( MainForm.Edit1.id ).setValue(值); //把值設定給Edit1


     MainForm.Edit1.getValue(); //取Edit1的值
    Ext.getCmp( MainForm.Edit1.id ).getValue() );
    

Js存取Label
    MainForm.Label1.setText(值); //設定
    Ext.getCmp( MainForm.Label1.id ).setText(值);
    Ext.getCmp( MainForm.Label1.id ).getWidth(); //取寬度
    var a=document.getElementByIdx_x( MainForm.Label1.id ). innerText; //取值
    var a=Ext.getCmp( MainForm.Label1.id ).text;  //取值
 
MainForm.UniButton4.getId(); //取Unigui控制項id
MainForm.UniButton4.id; //取Unigui控制項id

[UniURLFrame之使用]
UniLoginForm1.UniURLFrame1.iframe.contentWindow.document.getElementByIdx_x(‘container‘).
innerHTML=‘‘;
UniLoginForm1.UniURLFrame1.iframe.contentWindow.oldPoint = null;
top.document.getElementByIdx_x(top.MainForm1.BT_del.getId()).click();
top.MainForm.UniEdit1;

你在UniURLFrame中可以直接用top.form.控制項
這是extjs封裝過的

top.ajaxRequest(top.MainForm.UniURLFrame1,‘TestEvent‘,null);
這樣的服務端的UniURLFrame1的OnAjaxEvent就會觸發

所以得一個結論
在UniURLFrame使用extjs的東西要加top.
控制項如top.MainForm.UniEdit1
函數如top.ajaxRequest
多參考demo中ajax的範例
delphi中簡單使用
UniSession.AddJS(); //以執行js code
[unigui引用自定義js檔]
   範例: test.js存放在files\下
   內容: function aa(){
            alert(“aa”);
         }
   引用:uniServerModule的CustomFile屬性設定
        files/public.js
        or
        files\public.js

  使用1: 在delphi的程式
          UniSession.AddJS(‘aa();‘); //定義在UniGUIApplication
  使用2: 在元件(控制項)的ExtEvents.OnClick內
          alert(“aa”);
結論:
1.在delphi中如何取html的東西?
2.在js中如何取unigui的東西
3.js->delphi使用ajax
4.delphi接ajax在控制項的onajaxEvent中寫程式

ueditor應該是hmtl 用ajax->delphi就是html字串

【轉】如何在html與delphi間互動代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.