Print Page | Close Window

SetAutoColumnSizing problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=15075
Printed Date: 21 November 2024 at 6:07pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SetAutoColumnSizing problem
Posted By: znakeeye
Subject: SetAutoColumnSizing problem
Date Posted: 30 August 2009 at 8:33am
I don't want my columns to be auto-sized except for the last one!
 
GetReportHeader()->SetAutoColumnSizing(FALSE);
 
That has no effect as far as I can tell. Bug?
 
So I tried creating all my columns with bAutoSize = 0. That worked, except that the last column is not auto-sized. (And since I allow reordering of columns, I cannot create a rule for the bAutoSize-flag).
 
That is, when I resize my report control I don't want any of the columns to be affected except the last one, which shall fill the rest of the space. (Quite reasonable.)
 
A bug or a missing feature? I really need this though. Any chance you can fix it?


-------------
PokerMemento - http://www.pokermemento.com/



Replies:
Posted By: znakeeye
Date Posted: 30 August 2009 at 9:01am
Also, setting bAutoSize=1 in the CXTPReportColumn constructor yields a column which cannot be resized! That cannot be right!

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 30 August 2009 at 12:55pm
You need to call Col->SetAutoSize(FALSE) for each column Col except the last.
 
Initial bAutoSize assigned in constructor to two different flags - m_bAutoSize = bAutoSize and m_bIsResizable = bAutoSize
We need to set column resizable for user (keep m_bIsResizable = TRUE) and not for form resizing (set m_bAutoSize = FALSE)
 
Now your last column will fill all feasible report width
 
It also make sense to set pCol->SetMinWidth(...) for your last column - it will prevent making this column too narrow and force to use scrollbar 
 
Try this sample - e.g. I can resize this till the end of my second monitor and have last column to use 1.5 screens
 
https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStaticLastColumn.rar - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStaticLastColumn.rar  
 
btw - this sample also demonstrate multi-level virtual tree - use menu - Report - Simple 1-tree (obsolete title!)


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 31 August 2009 at 5:16am
Looks promising, but just like I said; reordering the columns breaks this.
 
If you move your last column to the left, you get strange behavior when resizing.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 31 August 2009 at 9:50am
An idea is to handle XTP_NM_REPORT_COLUMNORDERCHANGED, but what if I hide/remove the last column? It soon becomes too many cases to take care of...

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 31 August 2009 at 10:01am
Use nmData.nReason

xtpReportColumnChangeOther = 0x0000, // Neither column order nor group order is changed.

xtpReportColumnOrderChanged = 0x0001, // Column order changed.

xtpReportColumnGroupOrderChanged = 0x0002, // Group order changed.

xtpReportColumnAdded = 0x0010, // A column is added to the column list.

xtpReportColumnRemoved = 0x0020, // A column is removed from the column list.

xtpReportColumnWidthChanged = 0x0100, // The column width is changed.

xtpReportColumnShown = 0x0200, // A column visibility property is changed to "visible".

xtpReportColumnHidden = 0x0400, // A column visibility property is changed to "hidden".

xtpReportColumnMoved = 0x0800, // A column is moved.



-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 31 August 2009 at 10:25am
>>Looks promising, but just like I said; reordering the columns breaks this
It is not break - it just resized moved column and keep other untouched - sometimes this is a logical feature - your initial last column has long strings with needed info (say reason of some modificaitions) but you want to move it near another column (say timestamp) to have more information together

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 01 September 2009 at 2:58am
Thanks. I solved it by deriving CXTPReportHeader and handling OnColumnChanged. Before I call the base I modify my columns :)


Posted By: mdoubson
Date Posted: 02 September 2009 at 10:32am
What do you think about adding a special flags:
 
private m_bLastColumnExpand and m_bLastColumnExpandKeep with public SetLastColumnExpand(BOOL, BOOL) function to do all job with other columns to prepare such mode?
 
We can also use this setter on OnColumnChanged event in BASE class if second flag set to TRUE


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 02 September 2009 at 10:52am
Sounds like a great idea.


Posted By: znakeeye
Date Posted: 11 September 2009 at 5:45pm
Can't find SetLastColumnExpand in 13.2 beta
 
How am I supposed to test it? Will it be implemented in 13.2 release?


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 14 September 2009 at 6:14pm
You can try new demo app  https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewTrackStaticMod.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewTrackStaticMod.rar
 
It show some extention or your case - e.g. first columns - fixed and you can resize this columns and scrollbar will react on this. Last column - autozised and grow or shrink with form. You can also resize rows (same as columns) - select row and use tracker (up-down)
 
I still not implemented SetLastColumnExpand but hope to do it before oficial release
 


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 15 September 2009 at 3:10am
Good to hear.
 
I'll play a bit with your mod until then. Thanks.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 15 September 2009 at 3:49pm
I really hope this feature gets into 13.2 :)
I'm planning a big release with this version, and this is one of the remaining items I want to get fixed.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 15 September 2009 at 3:52pm
OK but what do you think about app I asked you to take a look?

-------------
Mark Doubson, Ph.D.


Posted By: SuperMario
Date Posted: 18 September 2009 at 12:40pm
Did Mark's solution resolve your problem?


Posted By: mdoubson
Date Posted: 18 September 2009 at 2:09pm
This is as simple as possible - check https://forum.codejock.com/uploads/DemoVersion/ReportSampleStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSampleStatic.rar  
and inside rinning app use menu - Report Control - Control Test - Task List sample
 
this is the code in the end of int CTaskListView::OnCreate(LPCREATESTRUCT lpCreateStruct) function

.......................................................................................

wndReport.Populate();

wndReport.SetFocus();

//----------------------------------------------------------------------------

wndReport.GetReportHeader()->SetAutoColumnSizing(FALSE);

int nColumnsCount = wndReport.GetColumns()->GetCount(), nColumn;

for (nColumn = 0; nColumn < nColumnsCount; nColumn++)

{

CXTPReportColumn* pColumn = wndReport.GetColumns()->GetAt(nColumn);

if (pColumn && pColumn->IsVisible())

pColumn->SetAutoSize(FALSE);

}

wndReport.GetColumns()->GetLastVisibleColumn()->SetAutoSize(TRUE);

wndReport.GetReportHeader()->SetAutoColumnSizing(TRUE);

//----------------------------------------------------------------------------

return 0;

}

Please play now with this TaskListView - resize form and see reaction - all columns untouched and last one will take all possible space


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 18 September 2009 at 2:34pm
I packed this piece of code into void CXTPReportHeader::SetLastColumnExpand(BOOL bLastColumnExpand, BOOL bLastColumnExpandKeep) function
 
see result in same sample in main sample view - try to resize and also drag and drop last column on other place -
it will keep get all resizing resources while other columns keep same width
 
Fresh code - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
 
beta-activex - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2.rar


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 21 September 2009 at 10:12am
Sure, but beware of user actions such as "Hide/show/move/remove column". If the last column is hidden, the second last column becomes the last one. So this setting must actively adapt to the column count/order!

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 21 September 2009 at 10:19am
You can also prevent such action for last column is you don't want it

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 04 May 2010 at 6:34am
What happened to the SetLastColumnExpand function? Will it be added in 14.x?

-------------
PokerMemento - http://www.pokermemento.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net