TcxScheduler有两种工作模式:

  一、非绑定模式

  非绑定模式下,数据被存储在文件系统中。要让scheduler工作在非绑定模式下,应使TcxScheduler.Storage属性绑定到TcxSchedulerStorage部件

  考虑到用户在不同的资源下安排用户事件,分如下步骤:

  1.定义不同的计划资源:

  在TcxSchedulerStorageResources.itmes创建2个资源,分别为其命名并将TcxSchedulerStorageResourceItem.ResourceID属性设置为1和2。

  2.在TCustomForm.OnCreate和TCustomForm.OnDestroy事件中:

procedure TUnboundForm.FormCreate(Sender: TObject);

const

DlgMsg = 'There was no file found';

FileName = 'c:\unbound.dat';

begin

if FileExists(FileName) then

// load the data from the file when the application starts up

Storage.LoadFromFile(FileName)

else

ShowMessage(DlgMsg);

end;

procedure TUnboundForm.FormDestroy(Sender: TObject; var Action: TCloseAction);

const

FileName = 'c:\unbound.dat';

begin

// save the data to the file when the application exits

Storage.SaveToFile(FileName);

end;

3.下面的代码演示如何安排用户事件:

with Storage.CreateEvent do

begin

// assign the newly created user event to the Nata Epelman resource

ResourceID := 2;

// specify the subject

Caption := 'Anniversary';

// this is the all-day event

AllDayEvent := True;

// synchronize with storage

Post;

end;

每个TcxSchedulerEvent实例代表最终用户的一个事件,对应TcxStorage的一个记录。

  用户事件的开始与结束时间由TcxSchedulerEvent的start与finish属性(TDateTime类型,该类型的使用可参见http://masprb.blog.sohu.com/194187241.html)指定。

  用户事件如果是全天事件,由TcxSchedulerEvent的AllDayEvent属性指定(Boolean类型)。

  用户事件的标题、标签颜色、位置、细节、状态分别由TcxSchedulerEvent的Caption、LabelColor、Location、Message、State指定。

  TcxSchedulerStorage.CreateEvent过程创建一个TcxSchedulerEvent实例。

绑定模式下,数据被存储在数据库系统中。要使scheduler工作在绑定模式下,应将TcxScheduler.Storage属性绑定到TcxSchedulerDBStorage部件。步骤如下:

1.创建两个用以存储数据的表SchedulerTable、SchedulerResourcesTable,结构如下:

create table schedulertable

(

ActualFinish int,

ActualStart int,

Caption varchar(255),

EventType int,

Finish datetime,

ID int,

LabelColor int,

Location varchar(255),

Message varchar(255),

Options int,

ParentID int,

RecurrentceIndex int,

RecurrenceInfo text,

ReminderDate datetime,

ReminderMinutesBeforeStart int,

RemminderResourcesData text,

ResourceID int,

Start datetime,

State int,

TaskCompleteField int,

TaskIndexField int,

TaskLinksField text,

TaskStatusField int

);

create table schedulerResourcesTable

(

ResourceID int,

ResourceColor int,

ResourceImageIndex int,

ResourceName varchar(255)

)

insert into schedulerResourcesTable(ResourceID,ResourceName) values(1,'日常工作计划');

insert into schedulerResourcesTable(ResourceID,ResourceName) values(2,'日常学习计划');

2.控件的使用

  在窗体上分别放置2个DataSource与Table控件,如下图所示:

  

3.控件的设置

  将cxSchedulerDBStorage的DataSource指向DS_Schduler,FieldNames中每个属性分别对应表中的相应字段。将cxSchedulerDBStorage的Resources的DataSource指向DS_Resource,ResourceColor、ResourceID、ResourceImageIndex、ResourceName分别指向表中相对应的字段。

4.创建user event的示例代码:

with SchedulerDBStorage.CreateEvent do

begin

ResourceID := 1; // assign the newly created user event to the Lesli Gritts resource

Caption := 'Birthday'; // specify the subject

AllDayEvent := True; // this is the all-day event

Post; // synchronize with storage

end;

TcxScheduler的使用的更多相关文章

  1. TcxScheduler的使用2

    DevExpress 行事历(Scheduler)的常用属性.事件和方法 参考资料来源:附带的ExpressScheduler 2  Demo, 如想了解更多可以查看Demo. 一.TcxSchedu ...

  2. DevExpress 行事历(Scheduler)的常用属性、事件和方法

    一.TcxScheduler[TcxScheduler常用属性]1.Storage    - 邦定一个Storage为Scheduler显示提供数据 2.DateNavigate.ColCount   ...

随机推荐

  1. python selenium2 窗口切换实例

    遍历hao123中某一区域的所有链接,点击每个链接时,会打开新的窗口,获取新窗口的title后关闭窗口,切换到初始窗口继续打开下一个链接 代码如下: #coding=utf-8 from seleni ...

  2. NOI前总结

    最近也就是天天考试,总结一下. 7.1 开场T1T2都是不可做的概率期望,只有T3看起来可做,于是怒干4h+,将题解里面的所有结论都推出来了,大模拟写的一点毛病都没有,可还是因为2-SAT掌握不熟结果 ...

  3. 胡小兔的NOIP2017游记【出成绩后更新版】

    胡小兔的NOIP2017游记[出成绩后更新版] 2017.11.22 Update 前几天成绩出来啦,看这篇博客访问量还挺多的,下面就分享一下结果吧: 我的Day1T2和Day2T1两道最水的题都跪了 ...

  4. es6字符串新特性

    转: 字符串的扩展 修改教程 上一节 : 变量的解构赋值 下一节 : 正则的扩展 字符串的扩展 ES6 加强了对 Unicode 的支持,并且扩展了字符串对象. 字符的 Unicode 表示法 Jav ...

  5. (一)C的编译,printf,规范化

    (一)编译的具体过程: 以前一直觉得,C代码的具体实现过程就是把几个.c文件编译成.o文件,然后链接在一起就可以了.可是最近在看C Prime Plus查漏补缺基础知识的过程中发现,这里的链接其实链接 ...

  6. P3807 【模板】卢卡斯定理

    P3807 [模板]卢卡斯定理 求 \(C_{m + n}^{m} \% p\) ( \(1\le n,m,p\le 10^5\) ) 错误日志: 数组开小(哇啊啊啊洼地hi阿偶我姑父阿贺佛奥UFO爱 ...

  7. 简便开发插件 -- lombok

    lombok是一款可以精减java代码.提升开发人员生产效率的辅助工具,可以利用注解在编译期自动生成setter/getter/toString()/constructor代码. 彻底将开发人员从繁琐 ...

  8. ElastAlert规则

    elastalert 是一款基于elasticsearch的开源告警产品(官方说明文档).相信许多人都会使用ELK做日志收集系统,但是产生一个基于日志的“优秀”的安全告警确是一个难题.告警规则难编写, ...

  9. Postgresql获取所有schema

    Postgresql 连接方式_连接五要素_psql: https://blog.csdn.net/u011402596/article/details/38510547 postgresql的sho ...

  10. 安装Win8引起Ubuntu启动项丢失的恢复过程

    画电路图的时候手痒,于是将之前做好的Win8PE拿出来装着玩儿.至于Win8的pE很好做,用UltraISO将Win8 的镜像用制作硬盘镜像的方法烧进U盘就行了. Win8的安装过程也很简单.安装前为 ...