Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
技术板块灌水区
» delphi 动态定义变量?
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: delphi 动态定义变量?
freefoxs
新警察
UID 44300
Digest Posts 0
Credits 6
Posts 2
点点分 6
Reading Access 10
Registered 2009-11-5
Status Offline
#1
Post at 2009-11-19 13:10
Profile
|
Blog
|
P.M.
delphi 动态定义变量?
程序中想根据不同文件名,动态生成变量名称,然后,再给这个变量赋值。
想知道DELPHI中能够怎么实现。
问过朋友说不是解释型语言,我觉得应该可以有解决问题的途径,可以完成这个功能。
麻烦高手给讲下。
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#2
Post at 2009-11-19 14:54
Profile
|
Site
|
Blog
|
P.M.
关于这个问题,首先要看你最初始的需求是什么?
Delphi 本身是编译型开发工具,普通的变量在编译成可执行文件后,变量名就丢掉了,只有 RTTI 中保存的类型信息可以在运行期访问。
如果你说的“变量”是指“组件”的话,倒是可以在运行时动态生成组件并赋予自定义的名称来访问。
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
freefoxs
新警察
UID 44300
Digest Posts 0
Credits 6
Posts 2
点点分 6
Reading Access 10
Registered 2009-11-5
Status Offline
#3
Post at 2009-11-19 15:49
Profile
|
Blog
|
P.M.
谢谢zjy,我是想检索不同的文件,一个文件会触发多个动作,我需要定义一个变量,把这个变量赋值为TRUE,这个变量每个文件都会用到,我想做一下区分。 想通过接口获取文件名后,自动把文件名作为变量名赋值,不同情况有的赋值TRUE,有的false。这样每个文件一个变量名就不会相互影响了。
bahamut8348
灌水司司长
UID 4743
Digest Posts
14
Credits 337
Posts 79
点点分 337
Reading Access 10
Registered 2007-1-18
Status Offline
#4
Post at 2009-11-24 16:26
Profile
|
Blog
|
P.M.
type
TYourRecord = record
Name: String;
Value: Boolean;
end;
TYourRecordList = array of TYourRecord;
.....
做人要厚道,看帖要回贴
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-25 13:23
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.009836 second(s), 9 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