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. mysql中while循环以及变量声明以及dilimiter

    首先我们查看一个正确的完整的一个存储过程 ①其中delimiter命令解释如下:默认情况下,delimiter是分号:.在命令行客户端中,如果有一行命令以分号结束,那么回车后,mysql将会执行该命令 ...

  2. Spanning Tree Protocol (STP) in NetScaler Appliance

    Spanning Tree Protocol (STP) in NetScaler Appliance 来源 https://support.citrix.com/article/CTX112341 ...

  3. MT【159】单调有界有极限

    已知数列$\{a_n\}$满足:$a_n>0,a_{n+1}+\dfrac{1}{a_n}<2,n\in N^*$.求证:(1)$a_{n+2}<a_{n+1}<2 (n\in ...

  4. [bzoj1875][SDOI2009] HH去散步 [dp+矩阵快速幂]

    题面 传送门 正文 其实就是让你求有多少条长度为t的路径,但是有一个特殊条件:不能走过一条边以后又立刻反着走一次(如果两次经过同意条边中间隔了别的边是可以的) 如果没有这个特殊条件,我们很容易想到dp ...

  5. Package ‘RSNNS’

    0 引言 Stuttgart Neural Network Simulator(SNNS)是德国斯图加特大学开发的优秀神经网络仿真软件,为国外的神经网络研究者所广泛采用.斯图加特神经网络模拟器(SNN ...

  6. App统计指标定义

    度量(指标) 定义 活跃用户 指启动应用的用户(去重,即1台设备打开多次会被计为1个活跃用户). 是衡量一个应用运营情况最基础的一个指标,用以表示用户规模.通常根据不同的时间限定,有日活跃用户.周活跃 ...

  7. Tomcat权威指南-读书摘要系列3

    3. 在Tomcat中部署Servlet与JSP Web应用程序 jar命令打包war文件 jar cvf examples.war .

  8. Spring知识总结

    一.Spring简述    Spring是一个分层的JavaSE/EEfull-stack(一站式)轻量级开源框架,Spring致力于提供一种方法管理你的业务对象,Spring的主要目的是使JavaE ...

  9. IOS取消performSelector警告

    #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks&quo ...

  10. PHP超级全局变量

    $_get:地址栏上获取值 $_post:post表单发送数据 $_request:即有get也有post的内容 如果post和get重名:那么由设置项决定,比如request_crder=" ...