Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 small datawindow problems..........

Status
Not open for further replies.

Delphiwhat

Programmer
Apr 1, 2003
74
EU
Hi everyone

Hope someone with more experience can help.

I've a datawindow which retrieves row data like ....


DATE TYPE STORAGE
01/02/04 square yes
01/02/04 round *yes*
01/02/04 cube yes
01/02/04 rectangle yes
01/02/04 circle yes


what i need to be able to do is
2 things

Part 1

1. change the TYPE column to show 'BLOCK' all the way down the column, this is for user viewing purposes only! I still need the database to hold the retrieved values in the database table ie. dont change the data for this col.

part 2

I need to be able to modify the data 'yes' in the 2nd row in the STORAGE Column to any string the user wishes to input. Then copy this into the cell above (ie row 1 storage colum) to save the user typing it twice. then save it back into the database table.

The only row column the user is allowed to edit is row 2 column storage. (shown as *yes* above)

Thanks in advance for your help its been driving me up the wall

delphiwhat?
 
part 1:

can be done by either
(a) setting a tabindex of zero for the 'TYPE' column
(or)
(b) protect the column by setting its protect expression to 1

part 2:
is it always going to be the second row? what if your database values change?

anyway,add the following in the itemchanged event of the datawindow control:

// make sure that the 'storage' column is changed
if dwo.name = 'storage' then
// is it row number 2?
if row = 2 then
// change the storage value of row 1
this.object.storage[1] = data
end if
end if
 
Thanks for you reply.

Is there a simple was of changing a retrieved column contents after retrival but just before display. Basiically I retrive a column like

eggs
bacon
bread
cheese
milk

but I want this column to show like to the viewer

Food
Food
Food
Food
Food

But I want the original column contents to be preserved so i cannot save the contents as 'Food' all the way down as It would corrupt my data. I need to be able to save the original values but show the viewer 'Food' for viewing purposes only.

Thanks for your help

 
Use a computed column on the datawindow with an expression which displays the value 'Food' when the other (databased retrieved) column has the values 'eggs', 'bacon', etc.
 
Thank for all your help. Got it sorted Much appreciated.

dw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top