Solved

Property problems

Posted on 1998-06-03
6
151 Views
Last Modified: 2010-04-06
I have a delphi program that accepts one command line parameter in the format 'propertyname1:propertyvalue1;propertyname2:propertyvalue2;' etc. The idea is that when I launch the program, I can set the values of a chosen objects properties from the comand line. I've stripped the command line down into two arrays, PropertyName[] and PropertyValue[]. What I need to do now is say something along the lines of Form1.graph1.PropertyName[index] := PropertyValue[index]; (which doesn't work!) In javascript there's a function called eval, which would let me construct a command from a string, so I could say eval('form1.graph1.' + PropertyName[index] + ' = PropertyValue[index]'). If PropertyName[index] was set to say, 'title', the command that would be interpreted would be form1.graph1.title = propertyvalue[index].
 Is there a similar command in delphi, or another way to poke the values into the required properties (maybe there's an array of properties i can loop through searching for a name match??)
 any ideas greatly appreciated,
cheers.
0
Comment
Question by:acsmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350011
I have written a unit which I use quite a bit.  It allows you to get & set PUBLISHED properties for any component.

E.g.
SetIntValue(MyComp, GetPropertyIndex(MyComp, 'Width'), 5);

If you'd like me to e-mail it to you, provide your e-mail address.

Cheers,
JB
0
 
LVL 1

Author Comment

by:acsmith
ID: 1350012
yes please, ta very much. my email is acsmith@hewitt.com
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350013
Hi

I have mailed the unit to you.

Cheers,
JB
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:acsmith
ID: 1350014
excellent! works a treat. cheers jimbob. Can you answer this with an answer so I can award your points??
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
ID: 1350015
Hi acsmith

Glad that it worked for you.

Cheers,
Dave
0
 
LVL 1

Author Comment

by:acsmith
ID: 1350016
cheers!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question