Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 8 Jahren, 3 Monaten
Letzter Beitrag:
vor 8 Jahren, 3 Monaten
Beteiligte Autoren:
John Marrone, Stefan Bentvelsen, Al

Highlight the table column that the table is sorted on

Startbeitrag von John Marrone am 14.03.2010 11:12

Hi

I'm trying to highlight the table column that the table is sorted on. And only that column. So when the user sorts the table by another column that column becomes the highlighted column and the previous highlighted column is return to normal.

I am finding it hard to instantly know which column is the sorted column with just the little down diamond that WD puts in the sorted columns caption.

My table has odd and even row color so this will probably make it harder to do, but I hope someone out there has wanted to do this and will shall with me what their approach was.
You know if I could just highlight the column header some how that would be ok. But when I highlight the column I have got to be able to return the previous highlighted column to normal. There has got to be a way to let the user know which column is sorted quicker than having to look for the little down diamond in the columns caption.

Thanks for any help at all that you might give me.

Antworten:

Hello John

You have a couple of options available to solve this question and your previous one regarding changing the column caption. In V14 each table column has a "whenever sorted" code event that you can use to manage the columns. I imagine that recording the column number to a window variable and passing it to a switch statement or an array and enumcontrol might be a methods you could use to turn on the current column and turn off the other columns

In terms of highlighting the sorted column you can place a graphic into the column heading with Table.columnName..TitleImage = "NameOfGraphicFile.bmp". Using a blank file name will turn off the graphic in the column heading
You can also use Table.columnName..Title = gPen(DarkRed)+Table.columnName..Title to change the colour of the title in the heading and gPen(IDfeaultColor) to set it back the way it was.

You can highlight the entire column with Table.columnName..BrushColor = ILightRed

Regards
Al


von Al - am 15.03.2010 08:46
Thanks Al that worked. Would you know what to do to make this work. Does WD have a command to set the table back to it's original state. My table has a different row color for odd and even rows. I want to do iLightGray on the whole column but how would you get that columns odd - even row colors back to what they were so when they sort on an other column the previous sorted columns row colors are set back to what they were, the same odd even colors as the rest of the rows. If I highlight the whole column that would really tell the user in a micro second which column is currently sorted. Thanks for any help.

von John Marrone - am 15.03.2010 11:01
Hi John,

have you already tried DefaultColor ?
See also the help index, use 'Color' as key word and look for 'Color in tables'. In WD12 (my currect version) there is a piece of text about colors in tables, columns, lines en cell's.


von Stefan Bentvelsen - am 15.03.2010 13:29
Thanks Stefan, I already check the help out. It didn't really cover what I need to do and most of it was dealing with the Description - Style tool panel. I think I have a work around . I am just going to use the IsOdd(tblMyTable) method and recolor the table rows in the row display event. And then when the row displays ends change the color of the the new sorted column with BrushColor.

Thanks for eveyone's help and time.

von John Marrone - am 15.03.2010 14:45
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.