Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - HOWTO: Get rid of sort arrow in header
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Get rid of sort arrow in header

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO: Get rid of sort arrow in header
    Posted: 19 December 2008 at 7:15am
Hi;

Any ideas, how I can get rid of sort arrow, when GetReportHeader()->AllowColumnSort(FALSE) is set?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2008 at 5:22am
No ideas?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 December 2008 at 12:40am

Hi,

do you sort report by this column ? or group ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2008 at 11:27am

CXTPReportColumn* pCol = wndReport.AddColumn(new CXTPReportColumn(COLUMN_FROM, _T("From"), 100));

pCol->SetSortable(FALSE);

pCol->SetAutoSortWhenGrouped(FALSE);

Last flag help to get rid from arrow
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2008 at 2:50pm
Yes Oleg, I do sort by some of the columns by code. But this sort order is unchangeable. I also group by two distinct columns.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2008 at 2:53pm
Originally posted by mdoubson mdoubson wrote:

CXTPReportColumn* pCol = wndReport.AddColumn(new CXTPReportColumn(COLUMN_FROM, _T("From"), 100));

pCol->SetSortable(FALSE);

pCol->SetAutoSortWhenGrouped(FALSE);

Last flag help to get rid from arrow


Hi;
In my case it's not working, because the columns have to be in a special (partially grouped) sort order. If I set SetAutoSortWhenGrouped(FALSE), the groups are no longer in the required sort order...
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2008 at 3:33pm

Use this flag in dynamic way - use falg as true - do you job - set flag false to prevent user action and clue - like here

void CReportSampleView::OnReportControlDevtest() {

GetReportCtrl().GetColumns()->GetSortOrder()->Clear();

CXTPReportColumn* pCol = GetReportCtrl().GetColumns()->Find(COLUMN_FROM);

if (pCol) pCol->SetAutoSortWhenGrouped(FALSE);

GetReportCtrl().RedrawControl();

}

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 4:49pm
Hi;
Once again this solution does not work in my case, because records are dynamically added/updated and removed and the sort order has to be maintained at each point of execution by the control itself. With your solution, each time any updates are done, I have to clear the internal sort order, clear the internal group order, temporary remove the group auto sort flag and manually redraw the control. This is too time consuming, since several 100 updates are executed per second.
Also I have to assure that the control itself never internally redraws at least the header part of the control - sort triangle flickering occures.
I believe that I have to create my own CXTPReportPaintManager derived class and overwrite DrawColumn().

But it would be much easier if the CXTPReportColumn::HasSortTriangle() could be made virtual.

Oleg, is this possible in a future release?

Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 6:47pm
There is another solution - use public BOOL

CXTPReportPaintManager::m_bDrawSortTriangleAlways

e.g. wndReport.GetPaintManager()->m_bDrawSortTriangleAlways = FALSE;

Now if flag TRUE - triangle follows Windows Explorer style - show triangle if there is enough space for at least first letter from column caption and triangle itself

if FALSE - show triangle only if there is enough space for full column caption and triangle itself (it means that for long caption triangle hides)
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 7:04pm
Hi;
Still not the right way!
It only removes the triangle, when the caption is larger than the column width. Append a large amount of spaces adds an ellipsis at the end of the caption...
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 7:19pm
No - you are wrong. If column width is enough for caption BUT not enough for caption AND triangle - it sacrifes triangle but not added ellipses if caption text fits
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 7:36pm
Hi;
In my case the columns are always wider than the caption text. So in any case, the triangle is drawn (BTW user resize of column widths is enabled). To prevent it I tried to add a lot of spaces to the end of each caption and voilá the ellipsis appears.
Perhaps you have an older version of the toolkit, or I miss something in any of my report message handlers.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2008 at 10:41pm
Ok - we can change model for release 13 -
instead of BOOL m_bDrawSortTriangleAlways use enum DrawSortTriangle: DrawSortTriangleIfFit = 0 and DrawSortTriangleAlways = 1 will served as now and NeverDrawSortTriangle = 2 will the case you like to have.
It will work for all columns. But what if somebody like to have individual column-base settings?
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2008 at 4:14pm
Very good idea!
DrawSortTriangle::NeverDrawSortTriangle should be set as soon as GetReportHeader()->AllowColumnSort(FALSE) is set.
But what do you think about the idea to change CXTPReportColumn::HasSortTriangle() to virtual too? This puts the developer in the position to change the behaviour on a column basis.

Until release 13 will be available, which of my presumed solution do you recommend with version 12?

Nevertheless, do you have any timeline for release 13?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2008 at 4:36pm

<<DrawSortTriangle::NeverDrawSortTriangle should be set as soon as GetReportHeader()->AllowColumnSort(FALSE) is set.

I am not sure - trianlge give user info about data presentation - does not mean that user CAN change it. Your intention to hide it may have some special logic but common one
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2008 at 5:18pm
Suppose you have a column sort order col 3 asc, col 4 asc, col 1 asc, col 2 asc. This results in four sort triangles shown in the header. The whole control is also grouped by col 5 followed by col 6. This kind of group and column sort order is required to display the records in a meaningful form. If the user changes this order the records are no longer in end user (quickly) recognizable style.
Additional, the triangles alone do not show the sort order position.
These issues are the reason why I do not need the sort arrows in the header.

I proposed NeverDrawSortTriangle/AllowColumnSort(FALSE) because of my special needs. The appearance of the triangle should of course be setable - on e per column basis - as you posted earlier...
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2009 at 6:39pm
Hi;

When will this extension to the report control be available?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2009 at 6:46pm
it already in source for release 13 - means Feb
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.