Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - ReportControl: Stop last being removed?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ReportControl: Stop last being removed?

 Post Reply Post Reply
Author
Message
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Topic: ReportControl: Stop last being removed?
    Posted: 24 June 2005 at 3:58am

In my report control, all columns have AllowRemove = true.

I'd like to prevent my users from removing the last column, regardless of the order in which they remove the columns.

Is this currently possible?

 

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 June 2005 at 10:37am
All I can suggest is to keep a global varable to keep track of how many rows are visible to start, then increment\decrement as columns are added\removed, then do something like this:

Private Sub wndReportControl_MouseDown(Button As Integer, Shift As Integer, X As Long, Y As Long)
    Dim hitColumn As ReportColumn

    Set hitColumn = wndReportControl.HitTest(X, Y).Column
    If Not hitColumn Is Nothing Then
        If ColumnCount <= 1 Then
         &nbs p;  hitColumn.AllowRemove = False
        End If
    End If
   
End Sub
Back to Top
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2005 at 11:09am

Thanks SuperMario.

I've already implemented the following code based on similar lines:

Private Sub xrcParent_ColumnOrderChanged()
Dim xrcCol As XtremeReportControl.ReportColumn
Dim iCountVisible As Long
On Error Resume Next

  ' Loop through column collection
  For Each xrcCol In xrcParent.Columns
    ' Count visible cols
    If xrcCol.Visible Then iCountVisible = iCountVisible + 1
    ' Exit Loop if more than one visible column
    If iCountVisible > 1 Then Exit For
  Next
  ' Set AllowColumnRemove based on visible columns
  xrcParent.AllowColumnRemove = (iCountVisible > 1)
 

Exit_xrcParent_ColumnOrderChanged:
  Set xrcCol = Nothing
  On Error GoTo 0
  Exit Sub
End Sub

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