Print Page | Close Window

ReportControl: Stop last being removed?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2446
Printed Date: 17 November 2024 at 5:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ReportControl: Stop last being removed?
Posted By: ianp
Subject: ReportControl: Stop last being removed?
Date 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?

 




Replies:
Posted By: SuperMario
Date 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


Posted By: ianp
Date 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




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