Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
技术板块灌水区
» 在Delphi 2007 下用TMemo控件的朋友小心了!
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: 在Delphi 2007 下用TMemo控件的朋友小心了!
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#1
Post at 2007-11-21 21:00
Profile
|
Blog
|
P.M.
在Delphi 2007 下用TMemo控件的朋友小心了!
Delphi 2007 下的VCL有不少新的改动,其中一项是TMemo的SelStart和SelLength等属性,
在以前的Delphi中,SelStart是根据字节数来定的,比如Memo中是字符串“a啊b吧aa”,欲把光标放在b字后,只需要SelStart := 4;即可。
而在Delphi 2007中,SelStart是根据字符数来确定的,欲把光标放“a啊b吧aa”的b字后,得SelStart := 3;才行。如果写了SelStart := 4;,光标则会出现在吧字后。
这个问题在Memo的查找替换时很明显,尤其是根据Length(string)进行长度判断的时候,字符和字节的混淆会给程序带来很显著的bug,包括CnWizards中的字符串编辑器的查找替换功能,以及编辑器专家收集面板的查找替换功能。
除了修改代码外,目前还未发现好的解决方案。
zzzl
(早安的空气)
版主
UID 590
Digest Posts 0
Credits 399
Posts 199
点点分 399
Reading Access 100
Registered 2004-11-29
Status Offline
#2
Post at 2007-11-21 22:15
Profile
|
Blog
|
P.M.
|
update3的tmemo没有右键菜单,有什么办法解决?
guoqingaa
新警察
UID 17107
Digest Posts 0
Credits 45
Posts 10
点点分 45
Reading Access 10
Registered 2007-6-10
Status Offline
#3
Post at 2007-12-1 14:11
Profile
|
Blog
|
P.M.
一句话,对照delphi7 的代码
dephi2007 和 delphi7 的对比后,自己改~~
我只看代码~~最求结果
dwf3110
新警察
UID 37768
Digest Posts 0
Credits 8
Posts 3
点点分 8
Reading Access 10
Registered 2008-2-23
Status Offline
#4
Post at 2008-2-23 15:06
Profile
|
Blog
|
P.M.
回复 #1 Passion 的帖子
字符串s:WideString,虽然每个字符 字节数双字节了,Length(s)=字节数;
其他字符串s:AnsiString(ShortString), Length(s)=字节数;
也就是说,字符类型发生了改变引起了上面的改变。
[
本帖最后由 dwf3110 于 2008-2-23 15:09 编辑
]
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 04:09
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008380 second(s), 7 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats