Board index » delphi » How to make a list to choose where to insert a new record

How to make a list to choose where to insert a new record

Hi,

I need a function for letting the user decide where to insert a new
record in a file where records are numbered from one and upwards. I have
tried two methods, but I am not satisfied with any of them.

1. I placed a TDBGrid on a Form which I called by ShowModal. The user
click on the record which the new one shall be placed before. It look
nice but I cannot figure out a good way to add a record at the end of
the list. I don't like to put an extra button there for doing that. I
would like to have a extra line at the end of the list wiht a title Add
to the end, but I don't see any other way to get that than to add an
extra temporary line to the database which I hesitate to do.

2. Instead I placed a ListView on my modal form, read the existing
record into the ListView and added my extra line. It look nice, but I
also want to highlight the record that was selected when insert was
chosen. I have tried with Selected and Focused, and the line is actually
highlighted, but if the list is longer than my form it isn't shown. I
have to scroll down to find it which is unaceptable.

Thankful for any suggestions.

Bengt

 

Re:How to make a list to choose where to insert a new record


Quote
In article <3BE6C3F4.536A6...@tv.slu.se>, Bengt H?kansson wrote:
> It look nice, but I
> also want to highlight the record that was selected when insert was
> chosen. I have tried with Selected and Focused, and the line is actually
> highlighted, but if the list is longer than my form it isn't shown. I
> have to scroll down to find it which is unaceptable.

See the ListItem.MakeVisible method.

Mike Orriss (TeamB and DevExpress)

Re:How to make a list to choose where to insert a new record


Mike,

thanks'. That was what I needed.

Bengt

Quote
"Mike Orriss (TeamB)" wrote:
> In article <3BE6C3F4.536A6...@tv.slu.se>, Bengt H?kansson wrote:
> > It look nice, but I
> > also want to highlight the record that was selected when insert was
> > chosen. I have tried with Selected and Focused, and the line is actually
> > highlighted, but if the list is longer than my form it isn't shown. I
> > have to scroll down to find it which is unaceptable.

> See the ListItem.MakeVisible method.

> Mike Orriss (TeamB and DevExpress)

Other Threads