使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit
2021-04-29 23:42
423 查看
使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit
TIWTimer //和 TTimer 没多大区别, 它的默认事件现在是异步的(OnAsyncTimer), 在网络上使用 OnTimer 肯定是非常糟糕的 TIWProgressBar //进度条 TIWProgressIndicator //进度提示器; 这是个新东西, 非常好; 当碰到时间较长的加载时(同步或异步)都可以用用; 使用前需要先关联到窗体的 ProgressIndicator 属性 TIWTimeEdit //个人认为这个东西一点用也没有; 只是给个分钟数按 8 小时换算成天、周之类, 如果需要还不如写个函数.
TIWTimer 所在单元及继承链:
IWCompExtCtrls.TIWTimer < TIWBaseHTML40Component < TIWBaseHTMLComponent < TIWBaseComponent < TComponent < TPersistent < TObject
主要成员:
property Interval: Integer // property Enabled: Boolean // property OnTimer: TNotifyEvent // property OnAsyncTimer: TIWAsyncEvent //
TIWProgressBar 所在单元及继承链:
IWCompProgressBar.TIWProgressBar < TIWCustomControl < TIWBaseHTMLControl < TIWBaseControl < TIWVCLBaseControl < TControl < TComponent < TPersistent < TObject
主要成员:
property BGColor: TIWColor //底色 property Color: TIWColor //进度色 property Percent: Integer //当前进度(0-100) property ShowText: Boolean //是否显示进度比例文本 property Font: TIWFont //
测试:
{在窗体上放 IWTimer1、TIWProgressBar1} procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin IWProgressBar1.ShowText := True; IWProgressBar1.Color := $0000FF; IWProgressBar1.Font.Color := $FFFFFF; end; procedure TIWForm1.IWTimer1AsyncTimer(Sender: TObject; EventParams: TStringList); begin IWProgressBar1.Percent := IWProgressBar1.Percent + 10; if IWProgressBar1.Percent >= 100 then IWTimer1.Enabled := False; end;
TIWProgressIndicator 所在单元及继承链:
IWCompProgressIndicator.TIWProgressIndicator < TComponent < TPersistent < TObject
主要成员:
property Css: string //这个弹出的等待窗口其实就是一个包含着 Table 的 Div, 可通过 Css 或下面几个属性弄得好看一点 property BGColor: TIWColor // property BoxColor: TIWColor // property BoxBorderColor: TIWColor // property BoxBorderWidth: Integer // property Opacity: Integer //透明度(0-100); 但等待窗口弹出时, 整个页面会有一个透明的遮罩层 property Mode: TIWProgressIndicatorMode //有效模式: pimAsync(异步)、pimSync(同步,默认)、pimBoth(两者都用) property BoxVisible: Boolean //是否以窗口的形式呈现; 默认 True property ImageVisible: Boolean //是否显示 Loading 动画图片; 默认 True property UserDefined: Boolean //是否禁用; 默认 False property PreScript: TStrings // property PostScript: TStrings // property PreAsyncScript: TStrings // property PostAsyncScript: TStrings // property ProgressTextSettings: TIWProgressTextSettings //提示文本相关设置 property RenderTag: TIWHTMLTag // function Render: string //Render 方法和 RenderTag 属性应该老控件没有的; 在调试时它们还是有点用的
测试:
{在窗体上放 IWProgressIndicator1 和两个按钮} procedure TIWForm1.IWAppFormCreate(Sender: TObject); begin Self.ProgressIndicator := IWProgressIndicator1; //关联到 IWProgressIndicator1 IWProgressIndicator1.Mode := pimBoth; //让同步异步都有进度提示 IWProgressIndicator1.ProgressTextSettings.Text := '正在载入...'; IWProgressIndicator1.ProgressTextSettings.Font.Color := clWebGreen; end; {同步事件} procedure TIWForm1.IWButton1Click(Sender: TObject); begin Sleep(3000); //等待 3 秒, 用于测试 end; {异步事件} procedure TIWForm1.IWButton2AsyncClick(Sender: TObject; EventParams: TStringList); begin Sleep(3000); end;
相关文章推荐
- 使用 IntraWeb (24) - 基本控件之 TIWFileUploader、TIWFile
- 使用 IntraWeb (27) - 基本控件之 TIWAudio、TIWMPEG、TIWFlash、TIWSilverlight、TIWSilverlightVideo、TIWApplet、TIWQuickTime、TIWActiveX
- 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent
- 使用 IntraWeb (21) - 基本控件之 TIWTabControl
- 使用 IntraWeb (31) - IntraWeb 的 Xml 操作使用的是 NativeXml
- 使用 IntraWeb (26) - 基本控件之 TIWMenu
- 使用 IntraWeb (32) - Url 映射与 THandlers
- 使用 IntraWeb (33) - Cookie
- 使用 IntraWeb (20) - 基本控件之 TIWGrid
- 使用 IntraWeb (22) - 基本控件之 TIWCalendar
- 使用 IntraWeb (34) - TIWAJAXNotifier
- 使用 IntraWeb (36) - TIWServerControllerBase
- 使用 IntraWeb (37) - TIWApplication
- 使用 IntraWeb (19) - 基本控件之 TIWTreeView
- 使用 IntraWeb (38) - TIWAppForm、TIWForm、TIWBaseHTMLForm、TIWBaseForm
- 使用 IntraWeb (39) - THttpRequest、THttpReply
- 使用 IntraWeb (18) - 基本控件之 TIWImage、TIWImageFile、TIWImageList
- 使用 IntraWeb (10) - CSS
- 使用 IntraWeb (8) - 系统模板
- 使用 IntraWeb (7) - 主模板