?
Solved

Urgent - Help with a AdvStringGrid Component (TMS Software)

Posted on 2007-10-15
9
Medium Priority
?
787 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:ST3VO
  • 5
  • 4
9 Comments
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 20077065
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
 

Author Comment

by:ST3VO
ID: 20077198
Is there anyway to do this without a query?  As the contents are actually the results of a query already.
0
 

Author Comment

by:ST3VO
ID: 20077222
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
Industry Leaders: 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 15

Expert Comment

by:mikelittlewood
ID: 20084561
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
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 20084574
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
 

Author Comment

by:ST3VO
ID: 20084658
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
 
LVL 15

Accepted Solution

by:
mikelittlewood earned 2000 total points
ID: 20084678
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
 

Author Comment

by:ST3VO
ID: 20084736
Perfect! Thanks Mike... :o)
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 20085343
Glad I could help
0

Featured Post

Industry Leaders: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 7 hours left to enroll

831 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