Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - RptCtrl: Programatically set column order
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

RptCtrl: Programatically set column order

 Post Reply Post Reply
Author
Message
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Topic: RptCtrl: Programatically set column order
    Posted: 23 December 2004 at 12:44am
The issue: We want the fields in the Report Control FieldChooser to appear sorted alphabetically.

In order to achieve this, the columns are added to the report control in alphabetical order (no problem, other than having to destroy and recreate the field chooser, if it is visible, every time a column is removed by the user since the removed column name will not appear sorted in the field chooser list. But, that is another issue).

However, the desired _default_ Column Order for this application is NOT alphabetical order.

Am I just missing something or is there really no way to programmatically set the column order other than to perform a SaveSettings after dragging the column headers to the desired configuration and then use the saved data in a call to LoadSettings on the initial startup of the application?
Back to Top
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2004 at 11:11am
Hummmmm......

Do these guys answer all of the questions posted here, or do they only answer the easy ones? <g>

The lack of a timely response certainly doesn't make one feel much like recommending the product....
Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2004 at 12:30pm

Typically questions are answered fairly quickly.  In the past, I've had posts go for months without a response.  I don't know if it was because they were overlooked or because they didn't have an answer.

You may want to email support directly if you need a more immediate response.

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2004 at 4:26pm
Maybe this is what you are looking for?

This is cut and paste from the help file:

This sample illustrates how to sort the columns in the ReportControl. If you had 8 columns added to the ReportControl, this sample would sort the columns first by the column at Itemindex 7, then by the column at ItemIndex 2, then by the column at ItemIndex 5.

    'This code below will add three columns to the SortOrder collection of coluns.
    'This will cause the columns in the ReportControl to first be sorted by column 7,
    'which has an index of zero (0) in the SortOrder collection. Columns are first sorted
    'in the order that they are added to the SortOrder collection.
    wndReportControl.SortOrder.Add wndReportControl.Columns(7)
    wndReportControl.SortOrder.Add wndReportControl.Columns(2)
    wndReportControl.SortOrder.Add wndReportControl.Columns(5)

    'This will cause the column at index 0 of the SortOrder collection to be sorted
    'in descending order.
    wndReportControl.SortOrder(1).SortAs cending = False

Back to Top
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Posted: 28 December 2004 at 8:34pm
>Maybe this is what you are looking for?

Nope, I'm not looking for sort order but rather, *column* order i.e. which columns appear, in order, from left to right in the control (column(5) in position 1, column(7) in position 2, column(1) in position 3, column(12) in position 4 & etc...).

Have you provided a method to accomplish this programmatically?
Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 9:15am

For the record, this is something I'm interested in as well.  I had assumed that ReportControl would offer this basic functionality, so I was disappointed to find out that it did not.  Programmatically setting column order is very important.

I'd like to provide an interface similar to Outlook that allows the users to use a dialog to control which columns are visible and in which order.  Without being able to change column order myself, this simply can't be done.

It looks like having a 'SortAscending' property in the FieldChooser should also be added.  Sorted alphabetically is the default order for fields in the Outlook FieldChooser.

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 12:01pm
Have you tried to delete the columns then add them back in the order you want?  You would need to keep track of the item index, as it is the index of the item in the record to show in the column.
Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 2:17pm

I haven't tried it, but I don't think it will work.  The ItemIndex is assigned based on the order the columns are added to the ReportControl.  If you delete them all and add them back in a different order, the ItemIndex for the columns will probably change (since they are being added in a different order than originally added) and will no longer correspond to the ReportRecordItems.

I don't there's going to be any acceptable workaround for this, so new functionality will need to be added.  You would think you could just change the 'Index' of a column to alter it's position, but this property is Read Only (even though the Documentation says it's a Read-Write Property ).

I hope a solution for this can be provided in the next release of ReportControl.  The ability to modify column positioning already exists (since you can drag/drop), so we just need to have it exposed programmatically.

Back to Top
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 4:06pm
>I hope a solution for this can be provided in the next release of ReportControl. The ability to modify column positioning already exists (since you can drag/drop), so we just need to have it exposed programmatically.


I agree and was pretty surprised that this basic functionality was omitted from the control.

Also, as long as we're asking for features, another thing the report control *really* needs is a virtual mode. Let us back the list with whatever storage we want and just ask us for the data when the control needs to draw an item. It's insane to have to create an object for each cell in the display.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 4:34pm
Virtual mode is going to be added next release
Back to Top
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2005 at 3:58am
>Virtual mode is going to be added next release

That's good news. So, the obvious follow-up question is..... When will that be?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2005 at 6:38am
Hopefully by the end of January
Back to Top
alpine View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote alpine Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2005 at 5:17pm
Cool! Do you need another beta tester? I'm in the process of doing a prototype that would be a great test-bed for the virtual report control and the timing for release would be just about perfect.
Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 12 January 2005 at 7:58am
I was told that a 'Move' method was added for the next release
Back to Top
wrecks View Drop Down
Groupie
Groupie


Joined: 14 July 2015
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrecks Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2021 at 5:34pm
Many years later, I had the same question.  
The answer is: use the Column.Move method.
Example:
   Columns.Find(7).Move(1)
Means move the column with ItemIndex 7 to Index 1.

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.156 seconds.