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
Solved

Property problems

Posted on 1998-06-03
6
148 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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