Print Page | Close Window

PlusMinus Icon in Group

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=17293
Printed Date: 15 November 2024 at 3:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PlusMinus Icon in Group
Posted By: JamGodz
Subject: PlusMinus Icon in Group
Date Posted: 22 September 2010 at 12:52am
Hi Everyone! Good Day!

How do i display the plus minus icon in group header? below is my code to customize the RC.

Private Sub Form_Load()
    rs.Open strSQL, ConnectTo.InternalConn, adOpenStatic, adLockOptimistic
    CustomizeRepCtrl
    If rs.RecordCount > 0 Then rs.MoveFirst: mdiMain.tpgFilter.Expanded = True: FillList
End Sub

Private Sub CustomizeRepCtrl()
    Dim Column As ReportColumn
    Set Column = wndList.Columns.Add(COLUMN_ICON_STATUS, "ICONSTATUS", 18, False)
        Column.Editable = False
        Column.Icon = COLUMN_BLACK_ICON
    Set Column = wndList.Columns.Add(COLUMN_TCODE, "HDA CODE", 50, True)
        Column.PlusMinus = True
        Column.Editable = False
    Set Column = wndList.Columns.Add(COLUMN_PLTRCODE, "Code", 50, True)
        Column.Editable = False
        'Column.Icon = COLUMN_ICON_PLTR
    Set Column = wndList.Columns.Add(COLUMN_PLTRNAME, "Pltr Name", 200, True)
        Column.Editable = True
        Column.EditOptions.SelectTextOnEdit = True
    Set Column = wndList.Columns.Add(COLUMN_HDANAME, "Hda Name", 200, True)
        Column.Editable = True
        Column.EditOptions.SelectTextOnEdit = True
    With wndList
        .Icons.LoadBitmap App.Path & "\Components\bullet\Bullet-black16.png", COLUMN_BLACK_ICON, xtpImageNormal
        .Icons.LoadBitmap App.Path & "\Components\bullet\Bullet-red16.png", RECORD_RED_ICON, xtpImageNormal
        .Icons.LoadBitmap App.Path & "\Components\bullet\Bullet-blue16.png", RECORD_BLUE_ICON, xtpImageNormal
        .Icons.LoadBitmap App.Path & "\Components\bullet\Bullet-green16.png", RECORD_GREEN_ICON, xtpImageNormal
        .Icons.LoadBitmap App.Path & "\Components\bullet\Bullet-yellow16.png", RECORD_YELLOW_ICON, xtpImageNormal
        '.Icons.LoadBitmap App.Path & "\Components\bullet\UserBlue.png", RECORD_BLUE_ICON, xtpImageNormal
        .Icons.LoadBitmap App.Path & "\Components\bullet\PlantersBlack1.png", COLUMN_ICON_PLTR, xtpImageNormal
        With .PaintManager
            .ColumnStyle = xtpColumnOffice2007
            .DrawGridForEmptySpace = True
            .VerticalGridStyle = xtpGridSmallDots
            .HorizontalGridStyle = xtpGridSmallDots
        End With
    End With
End Sub

Private Sub FillList()
    LoadData wndList, rs, "TCODE¦PLTR_CODE¦PLTR_NAME¦HDA_NAME¦PROGRESS", "PK", True,  COLUMN_TCODE
End Sub



Private Sub LoadData(ByRef srcControl As XtremeReportControl.ReportControl, ByRef srcRS As Recordset, ByVal srcField As String, Optional srcHiddenField As String, Optional bGroup As Boolean, Optional ByVal srcGroupBy As Integer)
    Dim xtrmRCRecord As XtremeReportControl.ReportRecord, i As Integer, Item As ReportRecordItem
    sSplit() = Split(UCase(srcField), "¦")
    If srcRS.RecordCount < 1 Then Exit Sub
    srcRS.MoveFirst
    With srcControl
        If bGroup = True Then .GroupsOrder.DeleteAll: .Records.DeleteAll
        .CreateRowNumberColumn 30
        .PaintManager.GroupRowTextBold = True
        .PaintManager.ShadeGroupHeadings = True
        .PaintManager.StartRecOrRowNumber = 1
    End With
    Do While Not srcRS.EOF
        Set xtrmRCRecord = srcControl.Records.Add()
        For i = 0 To UBound(sSplit())
            Set Item = xtrmRCRecord.AddItem(srcRS.Collect(sSplit(i)))
            If IsNull(Item.Value) Then Item.Value = Empty
        Next i
        If Len(srcHiddenField) > 0 Then xtrmRCRecord.Tag = srcRS.Collect(srcHiddenField)
        srcRS.MoveNext
    Loop
    If bGroup = True Then srcControl.GroupsOrder.Add srcControl.Columns.Find(srcGroupBy): srcControl.Columns.Find(srcGroupBy).Visible = False
    srcControl.Populate
    srcControl.SetCustomDraw xtpCustomBeforeDrawRow
    srcControl.Redraw
End Sub


Any help would be greatly appreciated....




Replies:
Posted By: Aaron
Date Posted: 22 September 2010 at 1:16am
Hi,
 
You want to switch visibility of some columns?
Following example will hide/show second colum:
 
With Me.wndReportControl
        With .Columns
            With .Add(.Count, "Col 1", 100, True)
                .PlusMinus = True 'Show 'button'
                .NextVisualBlock = 1 'Meaning number of columns that toggles visibility after this column 
            End With
            With .Add(.Count, "Col 2", 100, True)
            ....
        End With
End With
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JamGodz
Date Posted: 22 September 2010 at 1:54am
Hi Aaron...thank you for the replay...
Ive tried your code but still doesn't appear/display the plus/minus icon beside the planter name  please refer attached file, of what i mean...




Thanks...


Posted By: Aaron
Date Posted: 22 September 2010 at 3:07am
Hi,
 
OK, now I see what you mean Wink
 
wndReportControl.PaintManager.Glyphs.Icons collection, just add your own icons with proper index.
 
 
Minus icon index = 0
Unlocked icon index = 10
 
There are two more icons: Sort ASC + Sort DESC (11+12)
 
note: I see no icon in front of the grouprow??? Did you remove them already?
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JamGodz
Date Posted: 22 September 2010 at 3:14am
Hello!

i haven't remove any icon... coz i don't know how to put an icon... pls.. show me some code on how to display the plus and minus icon... tnx..


Posted By: Aaron
Date Posted: 22 September 2010 at 3:32am
Hi,
 
"Normally" it shows + / - icon already when records are grouped. See attached image
 
 
 
 
but you can try this:
 
Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
   
    If Row.GroupRow Then
        If Row.Expanded = False Then
            Metrics.GroupRowIcon = 1 'PLUS icon, use your own index of the icon
            Metrics.GroupRowIconAlignment = xtpGroupRowIconBeforeText
        Else
            Metrics.GroupRowIcon = 2 'MINUS icon, use your own index of the icon
            Metrics.GroupRowIconAlignment = xtpGroupRowIconBeforeText
    End If
   
End Sub
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JamGodz
Date Posted: 22 September 2010 at 3:47am
Hi Aaron... thank you the code works fine but the icon display not the minus/plus icon...







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