惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
V
V2EX
Jina AI
Jina AI
S
Schneier on Security
Cyberwarzone
Cyberwarzone
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
美团技术团队
小众软件
小众软件
L
LangChain Blog
N
Netflix TechBlog - Medium
大猫的无限游戏
大猫的无限游戏
T
Threatpost
T
Tor Project blog
K
Kaspersky official blog
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Security Latest
Security Latest
H
Heimdal Security Blog
N
News and Events Feed by Topic
T
Threat Research - Cisco Blogs
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
N
News | PayPal Newsroom
I
Intezer
博客园 - 聂微东
U
Unit 42
Cisco Talos Blog
Cisco Talos Blog
量子位
T
The Exploit Database - CXSecurity.com
Last Week in AI
Last Week in AI
博客园_首页
月光博客
月光博客
Webroot Blog
Webroot Blog
I
InfoQ
The Cloudflare Blog
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
Project Zero
Project Zero
Hacker News: Ask HN
Hacker News: Ask HN
IT之家
IT之家
Google DeepMind News
Google DeepMind News
C
Cisco Blogs

博客园 - 万一

关于内存数据与 JSON 高亮 TRichEdit 当前行 使用 IntraWeb (45) - 活用 IntraWeb 使用 IntraWeb (44) - 测试读取 SqLite (三) 使用 IntraWeb (43) - 测试读取 SqLite (二) 使用 IntraWeb (42) - 测试读取 SqLite (一) 使用 IntraWeb (41) - 数据控件速查 使用 IntraWeb (40) - 自定义 Session 数据 使用 IntraWeb (39) - THttpRequest、THttpReply 使用 IntraWeb (38) - TIWAppForm、TIWForm、TIWBaseHTMLForm、TIWBaseForm 使用 IntraWeb (37) - TIWApplication 使用 IntraWeb (36) - TIWServerControllerBase 使用 IntraWeb (34) - TIWAJAXNotifier 使用 IntraWeb (33) - Cookie 使用 IntraWeb (32) - Url 映射与 THandlers 使用 IntraWeb (31) - IntraWeb 的 Xml 操作使用的是 NativeXml 使用 IntraWeb (30) - TIWAppInfo、TIWMimeTypes、TIWAppCache 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm
使用 IntraWeb (35) - TIWJQueryWidget
万一 · 2014-06-25 · via 博客园 - 万一

可有可无的东西, 因为没有它也可以方便达成其目的, 使用它貌似更形象一些; 也可以通过它调用其他 js 库.

利用类似手段, 有人推出了 CGDevTools; 它主要是利用 JQuery 扩展而成, 而 TMS For IW 是通过传统的继承体系.

下面示例主要参考了: http://jqueryui.com


TIWJQueryWidget 所在单元及继承链:
IWCompJQueryWidget.TIWJQueryWidget < TComponent < TPersistent < TObject

主要成员:


property ContentFiles: TStringList //链接需要的 js 和 css 文件(远程或本地); 可用当前窗体的 ContentFiles; 如果全站使用可从 ServerController 单元 ContentFiles
property OnReady: TStringList      //调用; 可用 AddToInitProc() 代替

示例(http://jqueryui.com/datepicker/):



{在窗体上添加两个 IWEdit 和一个 IWJQueryWidget}
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  IWJQueryWidget1.ContentFiles.Add('//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css');
  IWJQueryWidget1.ContentFiles.Add('//code.jquery.com/jquery-1.10.2.js');
  IWJQueryWidget1.ContentFiles.Add('//code.jquery.com/ui/1.10.4/jquery-ui.js');
//  IWJQueryWidget1.ContentFiles.Add('//jqueryui.com/resources/demos/style.css');

  IWJQueryWidget1.OnReady.Add('$(".MyEditClass").datepicker();'); //.MyEditClass

  IWEdit1.Css := 'MyEditClass';
  IWEdit2.Css := 'MyEditClass';
end;

{抛开 IWJQueryWidget, 换种写法:}
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  ContentFiles.Add('//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css');
  ContentFiles.Add('//code.jquery.com/jquery-1.10.2.js');
  ContentFiles.Add('//code.jquery.com/ui/1.10.4/jquery-ui.js');

  AddToInitProc('$(".MyEditClass").datepicker();');

  IWEdit1.Css := 'MyEditClass';
  IWEdit2.Css := 'MyEditClass';
end;

效果图:


示例(http://jqueryui.com/accordion/):



{在窗体上放 IWJQueryWidget 和 IWText 各一个}
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  ContentFiles.Add('http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css');
  ContentFiles.Add('http://code.jquery.com/jquery-1.10.2.js');
  ContentFiles.Add('http://code.jquery.com/ui/1.10.4/jquery-ui.js');

  IWJQueryWidget1.OnReady.Add('$("#accordion").accordion();');

  IWText1.RawText := True;
  {下面测试文本复制于原网页, 这样写不如在设计时贴进去}
  IWText1.Lines.Text := '<div id="accordion">' +
    '  <h3>Section 1</h3>' +
    '  <div>' +
    '    <p>' +
    '    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer' +
    '    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit' +
    '    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut' +
    '    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.' +
    '    </p>' +
    '  </div>' +
    '  <h3>Section 2</h3>' +
    '  <div>' +
    '    <p>' +
    '    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet' +
    '    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor' +
    '    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In' +
    '    suscipit faucibus urna.' +
    '    </p>' +
    '  </div>' +
    '  <h3>Section 3</h3>' +
    '  <div>' +
    '    <p>' +
    '    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.' +
    '    Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero' +
    '    ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis' +
    '    lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.' +
    '    </p>' +
    '    <ul>' +
    '      <li>List item one</li>' +
    '      <li>List item two</li>' +
    '      <li>List item three</li>' +
    '    </ul>' +
    '  </div>' +
    '  <h3>Section 4</h3>' +
    '  <div>' +
    '    <p>' +
    '    Cras dictum. Pellentesque habitant morbi tristique senectus et netus' +
    '    et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in' +
    '    faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia' +
    '    mauris vel est.' +
    '    </p>' +
    '    <p>' +
    '    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.' +
    '    Class aptent taciti sociosqu ad litora torquent per conubia nostra, per' +
    '    inceptos himenaeos.' +
    '    </p>' +
    '  </div>' +
    '</div>';
end;

效果图: