Urgent - Help with a AdvStringGrid Component (TMS Software)

Hi Experts,

I have a problem with the AdvStringGrid component.

I know how to do this with a AdvStringGrid but it is different with the AdvStringGrid component.

I need to change the Title of one of the Headers and also replace the Field contents on that column.

The header is called: ''PhotoURL'' and I need the change that title to ''ImagePath''

Then I need to change all the fields in that column from ''Http://www.someweb.com/123.img'' to ''../images''

All the fields are changed to the same text ''../images''

Hope you can help as it's quite urgent!

Thanks

ST3VO
ST3VOAsked:
Who is Participating?
 
mikelittlewoodCommented:
Well I cant think of any other way that just using a loop to replace every cell value with the same text.

for i := 0 to grid.rowcount - 1 do
  grid.cells[ yourColNumber, i] := '.\imagespath\'
0
 
mikelittlewoodCommented:
You can manually change the title headers for the column in the object inspector.
Have you pre-setup the columns before loading the data into the grid or are you just letting the load of the dataset handle the column headers?

If you have pre-setup the columns, double click on the grid to bring up the fields editor.
Select the field and then in the object inspector you will find some properties called Header, HeaderAlignment and HeaderFont.
If you havent pre-setup then you will have to manually set them by code Grid.columns[x].header := 'xxx'

As for the second part of your question there are probably 2 ways of doing this, both would be via the actual query linked to the grid and not the grid itself.
Either create a calculated field based on your current one to produce a new string, or select the field in the query object and create an OnGetText handler to format the data to be displayed differently.
0
 
ST3VOAuthor Commented:
Is there anyway to do this without a query?  As the contents are actually the results of a query already.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
ST3VOAuthor Commented:
Hi Mike,

I've got another AdvStringGrid  question here in case you can help on this one too. :o)

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_22893310.html

Thanx!
0
 
mikelittlewoodCommented:
hmm my mistake I thought we were talking about a DBAdvGrid before which is why I was talking about a query, dont know where my head was at!

All the headers for the columns should be stored in the advStringGrid.columnHeaders property which is basically a stringList. So to access the individual column header you should only have to do something like
advStringGrid.columnHeaders[x] := 'some new title'
0
 
mikelittlewoodCommented:
As for the second part do you want to change each file name from
Http://www.someweb.com/123.img
to
../images/123.img
?
0
 
ST3VOAuthor Commented:
Well, I'm basically replace the field contents with a path for example:

Replace

Http://www.someweb.com/123.img 

with

.\imagespath\

The above field (path) will be the same for every field.

0
 
ST3VOAuthor Commented:
Perfect! Thanks Mike... :o)
0
 
mikelittlewoodCommented:
Glad I could help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.