CxGrid筛选自动添加百分号和默认旧的滚动条样式
CxGrid筛选自动添加百分号和默认旧的滚动条样式
约 693 字 预计阅读 2 分钟
【注意】最后更新于 2 months ago,文中内容可能已过时,请谨慎使用。
cxGrid支持使用like过滤时自动添加百分号
默认状态下, 不会添加 %% 到过滤串中, 修改源码如下
cxFilter.pas 在 \Library\Sources\cxFilter.pas 和 \ExpressDataController\Sources\cxFilter.pas 两个地方都有一个,一起修改掉
cxFilter.pas 的 TcxFilterCriteria.AddItem 改成这样
|
1
2
3
4
5
6
7
8
9
|
//if AParent = nil then
// AParent := Root;
//Result := AParent.AddItem(AItemLink, AOperatorKind, AValue, ADisplayValue);
if AParent = nil then
AParent := Root;
if AOperatorKind in [foLike, foNotLike] then
Result := AParent.AddItem(AItemLink, AOperatorKind, '%' + AValue + '%', ADisplayValue)
else
Result := AParent.AddItem(AItemLink, AOperatorKind, AValue, ADisplayValue);
|
cxFilterDialog.pas 在 Library\Sources\cxFilterDialog.pas和ExpressQuantumGrid\Sources\cxFilterDialog.pas
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// TcxFilterDialog.AddFilterItem
procedure TcxFilterDialog.AddFilterItem(AParent: TcxFilterCriteriaItemList;
AComboBox: TcxComboBox; AValue: Variant; ADisplayValue: string);
var
AOperator: TcxFilterControlOperator;
begin
AOperator := GetOperator(AComboBox);
if AOperator = fcoNone then Exit;
//edited by lero 09-11-18 如果是like,而且没有输入%时,自动在前后加入%
if AOperator in [fcoLike, fcoNotLike] then
begin
if VarIsStr(AValue) and (AValue <> '') and (Pos('%', AValue) = 0) then
AValue := '%' + AValue + '%';
end;
if AOperator in [fcoBlanks, fcoNonBlanks] then
AValue := Null;
if VarIsNull(AValue) or (VarIsStr(AValue) and (AValue = '')) then
ADisplayValue := cxGetResourceString(@cxSFilterBlankCaption);
Criteria.AddItem(AParent, ItemLink, GetFilterOperatorKind(AOperator), AValue, ADisplayValue);
end;
|
DevExpress控件滚动条默认使用旧的经典滚动条样式
新版本, 应该是17还是多少版本开始,默认使用触摸的滚动条样式, 查询了官方的论坛之后, 可以修改如下
搜索cxVer.inc 在 \Library\Sources\cxVer.inc 和 \ExpressCore Library\Sources\cxVer.inc 两个地方各有一个
打开后, 搜索 USETOUCHSCROLLUIMODEASDEFAULT 在 $DEFINE 前面加个点即可
|
1
|
{.$DEFINE USETOUCHSCROLLUIMODEASDEFAULT}
|
DevExpress下拉lookup控件加入输入时自动定位
- 单元
cxCustomData.pasLibrary\Sources\cxCustomData.pasExpressDataController\Sources\cxCustomData.pas修改如下
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
function TcxCustomDataController.DoIncrementalFilterRecord(ARecordIndex: Integer): Boolean;
var
S: string;
I: Integer;
begin
//edited by lero---
Result := False;
for I := 0 to Fields.ItemCount - 1 do
begin
S := GetInternalDisplayText(ARecordIndex, Fields[i]);
Result := DataCompareText(S, FIncrementalFilterText, True);
if Result then
begin
FDisplayIndex := i;
Exit;
end;
end;
//S := GetInternalDisplayText(ARecordIndex, FIncrementalFilterField);
//Result := DataCompareText(S, FIncrementalFilterText, True, FIncrementalFilteringFromAnyPos);
end;
|
在SortingBySummaryDataItemIndex属性下方添加, 不要忘了在private节下加入 FDisplayIndex:Integer;
|
1
|
property DisplayIndex: Integer read FDisplayIndex write FDisplayIndex; //add by lero
|
- 单元
cxLookupEdit.pas分别在Library\Sources\cxLookupEdit.pas和ExpressEditors Library\Sources\cxLookupEdit.pas
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// TcxCustomLookupEditLookupData.Locate
if ARecordIndex <> -1 then
begin
DataController.ChangeFocusedRecordIndex(ARecordIndex);
DoSetCurrentKey(ARecordIndex);
Result := True;
//此处为添加代码 add by lero---
if DataController.DisplayIndex > -1 then
begin
S := DataController.DisplayTexts[ARecordIndex, DataController.DisplayIndex];
DataController.DisplayIndex := -1;
end
else
begin
S := DataController.DisplayTexts[ARecordIndex, AItemIndex];
end;
//结束
//S := DataController.DisplayTexts[ARecordIndex, AItemIndex];
if IsLikeTypeFiltering then
ATail := ''
else
begin
AText := Copy(S, 1, Length(AText));
ATail := Copy(S, Length(AText) + 1, Length(S));
end;
DoSetKeySelection(True);
end
else
DoSetKeySelection(False);
|
CxGrid筛选自动添加百分号和默认旧的滚动条样式的更多相关文章
- chrome浏览器当表单自动填充时,怎么去除浏览器自动添加的默认样式。
参考blog来自 http://segmentfault.com/q/1010000000671971 chrome浏览器当表单自动填充时,怎么去除浏览器自动添加的默认样式. 一.发现该问题的原因-是 ...
- WordPress发布文章/页面时自动添加默认的自定义字段
如果你每篇文章或页面都需要插入同一个自定义字段和值,可以考虑在WordPress发布文章/页面时,自动添加默认的自定义字段.将下面的代码添加到当前主题的 functions.php 即可: 1 2 3 ...
- sql server小技巧-自动添加时间与主键自增长
在敲机房收费系统的时候,遇到添加时间的时候总是通过vb端调用当前时间再添到sql server中,期间还有时因为添加时间格式的不统一导致一些小问题,现在才知道原来是自己孤陋寡闻,sql server ...
- Javascript禁止网页复制粘贴效果,或者复制时自动添加来源信息
一.禁止复制 使用方法:在oncopy事件中return false oncopy="return false;" 1.禁止复制网页内容 <body oncopy=" ...
- sublime 设置新建文件自动添加author(作者)等文件头信息
很多时候, sublime 自带自动添加文件头信息, 但是并不是我们想要比如下面这样的:新建一个python文件 自动添加的author 信息== 上面并不是我想要的, 我想要下面这样的效果:== 这 ...
- CentOS 7 实现zabbix agent 自动添加,并链接到指定的模版
如果添加的agent端数量较少时 , 手动添加还是可以的 , 如果数量较多 , 那么zabbix-server 的Discovery自动发现功能便派上了用场 首先所需要加入的服务器zabbix-age ...
- python logging详解及自动添加上下文信息
之前写过一篇文章日志的艺术(The art of logging),提到了输出日志的时候记录上下文信息的重要性,我认为上下文信息包括: when:log事件发生的时间 where:log事件发生在哪个 ...
- 为C函数自动添加跟踪语句
目录 为C函数自动添加跟踪语句 声明 一. 问题提出 二. 代码实现 2.1 函数匹配测试 2.2 插入跟踪语句 三. 效果验证 为C函数自动添加跟踪语句 标签: Python 正则表达式 声明 本文 ...
- mybatis JdbcTypeInterceptor - 运行时自动添加 jdbcType 属性
上代码: package tk.mybatis.plugin; import org.apache.ibatis.executor.ErrorContext; import org.apache.ib ...
随机推荐
- 当前页面刷新和动态添加控件的jquery事件绑定on
当前页面刷新(console): location.reload() 给动态添加的控件添加js事件(委托): <ul> <li>菜单一</li> <li> ...
- [Robot Framework] Robot Framework用Execute Javascript对XPath表示的元素执行Click操作
Execute Javascript document.evaluate("//a[contains(@href,'createBook')]", document, null, ...
- PreparedStatement批量处理和事务
PreparedStatement批量处理和事务代码如下: /* * PreparedStatement: 1.addBatch() 将一组参数添加到 PreparedStatement对象内部 2. ...
- 【转】VxWorks中高精度实时时钟的实现及C语言汇编混合编程
最近一个项目中需要在VxWorks下使用一个高精度实时时钟,要求精度为1ms,溢 出时间大于5小时.VxWorks提供系统时钟,该时钟在操作系统启动后开始计数,精度为1个tick,可以通过tickGe ...
- JWT设计实现
一.JWT基于token的认证流程: 二.JWT SDK的选取: https://jwt.io/ 三.编写JWT Helper: 1.获取token 设置密钥,规定算法,设置过期时间,设置发行方,生命 ...
- [C#.NET]最简单的实现文本框的水印效果
C#项目开发中在设计登录界面时,经常会遇到TextBox的水印提示要求.这里简单描述一下项目在实现水印提示的过程设置.如下图图1所示. 图1 窗体布局 一.窗体布局(如图1所示) 1. 在窗体中放 ...
- ios蓝牙自定义快捷键
http://www.paopaoche.net/app/12072.html Beekeyboard
- 20155312张竞予 20170510实践一:在IDEA中以TDD的方式对String类和Arrays类进行学习
实践题目 在IDEA中以TDD的方式对String类和Arrays类进行学习 测试相关方法的正常,错误和边界情况 String类 charAt split Arrays类 sort binarySea ...
- Bubble(冒泡排序)————Java
用Java进行冒泡排序的代码,利用一个flag进行优化算法: import java.util.Scanner; public class Bubble_Sort { private static i ...
- lf-8.4 数据的增删改
MySQL数据操作: DML 在MySQL管理软件中,可以通过SQL语句中的DML语言来实现数据的操作,包括 使用INSERT实现数据的插入 UPDATE实现数据的更新 使用DELETE实现数据的删除 ...