Print Page | Close Window

Value change / Revert automaticly

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=24445
Printed Date: 03 December 2024 at 12:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Value change / Revert automaticly
Posted By: simps
Subject: Value change / Revert automaticly
Date Posted: 27 December 2023 at 8:16am
Problem : if item caption is changed once, it's not able to be changed again manually.

to see my problem clearly;
vb6 / new project
add reportcontrol1
copy & paste the code below.



Option Explicit

Private Sub Form_Load()
    Dim newRec As ReportRecord
    With ReportControl1
        .SetCustomDraw (xtpCustomBeforeDrawRow)
        .Columns.Add 0, "Add", 100, True
        .Columns.Add 1, "Part Name / Component", 200, True
        .Columns.Add 2, "Purchase Order Qty", 100, True
        .Columns.Add 3, "Production Order Qty", 100, True
        .Columns(1).TreeColumn = True
        Set newRec = .Records.Add
            newRec.AddItem ""
            newRec.Item(0).HasCheckbox = True
            newRec.AddItem "Car"
            newRec.AddItem 2
            newRec.AddItem 2
            newRec.Item(0).HasCheckbox = True
            .Populate
        Set newRec = .Rows(0).Record.Childs.Add
            newRec.AddItem ""
            newRec.Item(0).HasCheckbox = True
            newRec.AddItem "Part-A"
            newRec.AddItem 4
            newRec.AddItem 4
            newRec.Item(0).HasCheckbox = True
        Set newRec = .Rows(0).Record.Childs.Add
            newRec.AddItem ""
            newRec.Item(0).HasCheckbox = True
            newRec.AddItem "Part-B"
            newRec.AddItem 4
            newRec.AddItem 4
            newRec.Item(0).HasCheckbox = True
         Set newRec = .Rows(0).Record.Childs.Add
            newRec.AddItem ""
            newRec.Item(0).HasCheckbox = True
            newRec.AddItem "Part-C"
            newRec.AddItem 2
            newRec.AddItem 2
            newRec.Item(0).HasCheckbox = True
        newRec.ParentRecord.Expanded = True
        
        .Columns(1).Editable = False
        .Columns(2).Editable = False
        .Populate
        .AllowEdit = True
    End With
End Sub

Private Sub Form_Resize()
    ReportControl1.Move 120, 120, Me.ScaleWidth - 240, Me.ScaleHeight - 240
End Sub

Private Sub ReportControl1_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    If Item.Index = 3 Then Metrics.BackColor = vbYellow
End Sub

Private Sub ReportControl1_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
    If Row.RowTreeLevel = 0 Then
        Dim rr As ReportRow
        Dim multi
        multi = Row.Record.Item(2).Caption / Row.Record.Item(3).Caption
        For Each rr In Row.Childs
            rr.Record.Item(3).Caption = CDbl(rr.Record.Item(2).Caption) / multi
        Next
        ReportControl1.Populate
    End If
End Sub



-------------
VB6



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