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 ...
随机推荐
- VisualStudio使用技巧
控制台工程去除黑框 刚学习OpenGL,绘制图形的时候,如果不进行设置,运行的时候会先出现黑窗口再出现Windows窗口.其实要去除控制台窗口非常简单,只需要修改工程设置,把子系统改成Windows, ...
- PLSQL数组
declare type t_varchar_arr is TABLE OF varchar2(60); type t_number_arr is TABLE OF number; v_date t_ ...
- .net从网络接口地址获取json,然后解析成对象(一)
整理代码,今天遇到一个问题,就是从一个场景接口获取json,然后解析成对象.之前的时候都好好的,这次返回的json字符串里,由于字符编码的问题,格式上不能转换.一直以为是解析的过程编码有误,试了utf ...
- service层代码相互调用, 导致spring循环依赖,设计上的优化
管理员创建用户需要发送激活邮件, 而发送激活邮件的时候需要判断发件人是不是合法的用户, 因此设计到一个循环依赖的问题 //UserService @Service class UserService{ ...
- python学习 day18 (3月25日)---( 面向对象浅析)
面向对象思想: 字典表示对象: 不是太好 因为 变量 得一个个的赋值改值 {'name':'alex','blood':20,'attack':1,'sex':'不'} {'name':'太亮','b ...
- 检测鼠标是否在UI上unity
public static bool IsCursorOnUI(int inputID=-1){ EventSystem eventSystem = EventSystem.current; retu ...
- swift - 导航设置总结加深记忆
一.创建导航 let VC=ViewController() let navigationC = UINavigationController(rootViewController: V ...
- ZSetOperations 操作解释 拷贝过来的 哈哈哈
有序集合,默认按照score升序排列,存储格式K(1)==V(n),V(1)=S(1)(K=key,V=value,S=score) 1.add(K,V,S):添加 2.count(K,Smin,Sm ...
- (17)Questioning the universe
https://www.ted.com/talks/stephen_hawking_asks_big_questions_about_the_universe/transcript00:13There ...
- hashable/iterable与orderable
################ # hashable协议 # ################ # 一个对象能被称为hashable,它必须实现__hash__与_eq__方法: >>& ...