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. Lattice Point or Not UVA - 11768(拓展欧几里得)

    原文地址:https://www.cnblogs.com/zyb993963526/p/6783532.html 题意: 给定两个点A(x1,y1)和B(x2,y2),均为0.1的整数倍.统计选段AB ...

  2. [AT2401] [arc072_e] Alice in linear land

    题目链接 AtCoder:https://arc072.contest.atcoder.jp/tasks/arc072_c 洛谷:https://www.luogu.org/problemnew/sh ...

  3. 51nod 1295 XOR key | 可持久化Trie树

    51nod 1295 XOR key 这也是很久以前就想做的一道板子题了--学了一点可持久化之后我终于会做这道题了! 给出一个长度为N的正整数数组A,再给出Q个查询,每个查询包括3个数,L, R, X ...

  4. Letter Combinations of a Phone Number - LeetCode

    目录 题目链接 注意点 解法 小结 题目链接 Letter Combinations of a Phone Number - LeetCode 注意点 可以不用按字典序排序 解法 解法一:输入的数字逐 ...

  5. LINUX第四周学习

    <Linux内核设计与实现>第四周读书笔记——第五章 5.1 与内核通信57 系统调用在用户空间进程和硬件设备之间添加了一个中间层,该层主要作用有三个: 首先它为用户空间提供了一种硬件的抽 ...

  6. 遇到问题---java---安装新版本jdk后Failed reading value of registry key

    情况 情况是原本安装有jdk1.7,能正常运行,现在要升级到1.8. 直接在oracle的网站下载1.8安装后修改配置为1.8后: 能用javac编译成功,但java命令运行时报错: Failed r ...

  7. Android Data Binding(数据绑定)用户指南

    Android Data Binding(数据绑定)用户指南 http://www.jianshu.com/p/b1df61a4df77 https://github.com/LyndonChin/M ...

  8. (转)maven镜像详解

    背景:一直以来,对maven镜像不是特别的了解,这里通过对网上资料的收集,做个详细的记录. 镜像介绍 如果仓库X可以提供仓库Y存储的所有内容,那么就可以认为X是Y的一个镜像.换句话说,任何一个可以从仓 ...

  9. nginx让用户通过用户名密码认证访问web页面

    在使用nginx转发的时候,要进行一次用户身份的确认. 1)通过htpasswd命令生成用户名及对应密码数据库文件. [root@bgs-5p173-wangwenting ~]# htpasswd ...

  10. 初学SQL语句练习2

    -- 子查询 --单行子查询-- 查询出所有比雇员姓名为“CLARK ”工资高的员工的信息 SELECT * FROM EMP WHERE SAL > (SELECT SAL FROM EMP ...