DBGrid question (repost, got no answer first time)

DBGrid question (repost, got no answer first time)

Post by Frederic MARA » Sun, 31 Dec 1899 09:00:00



Hello,

I have a seemingly simple question, to which I can't find a solution.

Simply put, I'd like to have an event handler invoked when I click (or
double click) on a column header, to know which column was
selected. The obvious idea is to then switch indexes on the underlying
TTable object to reorder the display.

Of course, I can get called on a click or double-click, but the
table1.SelectedField.FieldIndex returns the number of the last column in
which data were selected, or 0 if DBG.Options.SelectRow = True

Would anyone have a suggestion on how to get this, as well as how to
change the appearance of selected column headers to suggest some are
clickable and others aren't ?

This would preferably be in Delphi 1, but Delphi 2 is acceptable. Delphi
3 is not.

Thanks.

 
 
 

DBGrid question (repost, got no answer first time)

Post by Alain Quesne » Sun, 31 Dec 1899 09:00:00


Try RxDbGrid that comes with RxLib. It's free w/source and it's compatible
with D1, D2 and D3. It provides a TitleButtons property. The column headers
become clickable buttons. Your column headers can even take a different
color to indicate which field the current index is based on.
--
http://rx.unionjv.ru/

Alain Quesnel

P.S: if you reply by e-mail, remove the brackets
on each side of my address.



> Hello,

> I have a seemingly simple question, to which I can't find a solution.

> Simply put, I'd like to have an event handler invoked when I click (or
> double click) on a column header, to know which column was
> selected. The obvious idea is to then switch indexes on the underlying
> TTable object to reorder the display.

> Of course, I can get called on a click or double-click, but the
> table1.SelectedField.FieldIndex returns the number of the last column in
> which data were selected, or 0 if DBG.Options.SelectRow = True

> Would anyone have a suggestion on how to get this, as well as how to
> change the appearance of selected column headers to suggest some are
> clickable and others aren't ?

> This would preferably be in Delphi 1, but Delphi 2 is acceptable. Delphi
> 3 is not.

> Thanks.



 
 
 

1. selecting a record in a DBGrid and always getting the first one

I select a record in a DBGrid on a certain form

Then I display all the data off the database but without using the
datasource property for other reasons to hard to explain.

I always get the first record off the database and haven't got a clue why
that is

thanks for any hint or sollution you've got, you will then always be at the
top of my list

2. Changing password for startup

3. Repost: Foxpro 2.0 Memo field Question, please answer....

4. Running till no more locks available

5. Repost: Can someone PLEASE answer my question!?

6. Importing Advantage Database Tables into Access 2000

7. Thanks to all who answered my first stupid question

8. DTS information from one server to another

9. Getting SQL Questions Answered

10. answer to the Run-time question?

11. Silly question time -- with answer (long)

12. Question and answer lost on a SQL query (answer from avegaart)