Report Control in dialog layout problems |
Post Reply |
Author | |
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
Posted: 30 April 2007 at 7:27pm |
Hi
I'm having problems with the report control layout using it in a dialog. I'm using it as a replacement for a CListCtrl, so that I can set font / styles / colours etc per cell.
If you set SetAutoColumnSizing(FALSE), so that resizing columns kinda behaves itself (i.e. only resizes the column you are resizing), then if you make the headers wider than the window (I'm using the control inside a dialog, so it's restricted in size) it displays a scrollbar.
The scrollbar doesn't respond to any mouse events, so you can't actually scroll to see the final columns, which makes for an unpleasant user experience.
Also if the total columns doesn't add up to the width of the control, then the final gap is exactly that - a gap: no gridlines. It's a bit ugly.
So is there a workaround for this? Do I have to add an empty column at the end or something? And what about scrolling?
Thanks
Adrien
|
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
PS, this is 11.1.0
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
1) Scrolling at least is working in a regular sample applications; I'm not sure which methods you call and in which sequence to make it non-working; need more information, an attached piece of code for example. 2) You can leave AutoColumnSizing enabled, but disable resizing for each particular column except the last one for example. In this case only the last column will be resized with the control itself. -- WBR, Serge |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
Hi
thanks for your reply. I'm having problem with vertical scroll as well. Basically the scroll-bars don't seem to get messages. If I click in the control and use the mouse-wheel it scrolls, but the scroll-bar itself ignores mouse events.
My code is like this
in the DIALOG RC file, I have created a frame items. it has styles WS_NOTIFY, WS_VISIBLE, and WS_EXCLIENTEDGE
then in the dialog class, I use
DDX_Control(pDX, IDC_REPORTCONTROL, m_Schema);
This then creates the control with the styles that the control in the dialog resource has. To draw I use
CXTPReportColumn* pFirstCol = new CXTPReportColumn(0, "Symbol", 180, FALSE);
m_Schema.BeginUpdate();
m_Schema.AddColumn(pFirstCol); m_Schema.AddColumn(new CXTPReportColumn(1, "Type", 70, FALSE)); m_Schema.AddColumn(new CXTPReportColumn(2, "Access", 70, TRUE)); pFirstCol->SetTreeColumn(TRUE);
m_Schema.AddRecord(...);
m_Schema.AddRecord(...); etc
m_Schema.Populate();
m_Schema.GetSelectedRows()->Clear();
m_Schema.EndUpdate(); m_Schema.RedrawControl(); I suspect if I explicitly call Create on the control it may get the scroll-messages but I haven't tried that one yet.
couple of things I don't like.
1. Have to call Clear() on GetSelectedRows, else the control selects row 1 by default, which paints it grey. by default nothing should be selected until a user explicitly selects it.
2. Clicking outside a row in the control doesn't reset the selected rows either. It would be nice if it did, otherwise I have to add a notify handler to do this.
3. The tree control mode doesn't use standard tree control layout. specifically an expand/contract glyph has an "elbow" line coming into it from the side rather than a straight one down from the top the top (as in a tree control), and the line style is not settable (i.e. can't do dotted lines like a real tree control).
Adrien
|
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
As I thought, if I use a call to Create to create the report control, the scrollbars work.
Down-side is I'm having trouble setting extended styles on the control now for its border. I'm calling Invalidate() to get it to redraw, but it wont.
not until I expand a tree item in the report - then it displays the border on the control. It's driving me nuts.
Also, I tried setting autosize off on some columns, but now I can't manually resize them either? what's with that? Surely turning off auto-resizing should do that, and that alone - not disable sizing altogether.
|
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
OK, got it drawing the extended styles at the start. I had to call CreateEx to do it though, which requires a WndClass. I couldn't find a way to get the WndClass of the report control, so I just used AfxRegisterWndClass(0), which seems to work.
Need to add a CreateEx call to the report control.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
The Report Wnd class is defined in XTPREPORTCTRL_CLASSNAME. See implementations of: CXTPReportControl::RegisterWindowClass, CXTPReportControl::Create See also our ReportDialog sample. About columns -- see methods: CXTPReportColumn::IsAutoSize, bAutoSize parameter in the constructor CXTPReportColumn::IsResizable, EnableResize -- WBR, Serge |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |