Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - SOLVED: EditOptions.Constraints
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: EditOptions.Constraints

 Post Reply Post Reply
Author
Message
eswohnai View Drop Down
Newbie
Newbie
Avatar

Joined: 11 July 2008
Location: United Kingdom
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote eswohnai Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: EditOptions.Constraints
    Posted: 11 July 2008 at 11:38am
I have a Report Control where I need to fill a Combo with custom values. 
 
If there is already one instance of a value on the Grid,  when I go to a different row, and go into the Combo that item needs removing.
 
The way I was going to do it to call .EditOptions.Constraints.DeleteAll before repopulating the Constraints but this is removing all entries for my Column.
 
Does any one have any suggestions for getting around this?
 
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 11 July 2008 at 3:16pm
Hi,
 
Do you use CreateEditOption for a single cell? And use the InplaceButtonDown event to delete all constraints?
 
 
Can you upload a sample project?
 
 
 
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....
Back to Top
eswohnai View Drop Down
Newbie
Newbie
Avatar

Joined: 11 July 2008
Location: United Kingdom
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote eswohnai Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2008 at 7:16am

Aaron,

Thanks for your reply.  Using the CreateEditOption seems to of done the trick bar one small problem.  When I click into the Cell.  Even if the text matchs what is in the constrait, it blanks the entry.  If I select it from the drop down it is fine. 

As I don't know how to post a sample I will just copy all my current code below.  You will need to add a Report Control to a form and call it grdSample.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Option Explicit
Private Sub Form_Load()
   
    On Error GoTo ERR_HANDLER
   
    Call SetupGrid
   
    Call AddRecordToGrid(1)
    Call AddRecordToGrid(2)
    Call AddRecordToGrid(3)
    Call AddRecordToGrid(4)
   
    Exit Sub
   
ERR_HANDLER:
   
    MsgBox "Error in Form1.frm::Sub Form_Load: Error " & Err.Number & " - " & Err.Description
   
End Sub
Private Sub AddRecordToGrid(ByVal RecordID As Integer)
   
    On Error GoTo ERR_HANDLER
   
    Dim objRecord As ReportRecord
    Dim objRecordItem As ReportRecordItem
   
    Set objRecord = grdSample.Records.Add()
   
    Set objRecordItem = objRecord.AddItem(RecordID)
    Set objRecordItem = objRecord.AddItem(Trim("Line " & CStr(RecordID)))
    Set objRecordItem = objRecord.AddItem("Some random notes")
   
    Set objRecordItem = Nothing
    Set objRecord = Nothing
   
    grdSample.Populate
    grdSample.Redraw
  
    Exit Sub
   
ERR_HANDLER:
   
    MsgBox "Error in Form1.frm::Sub AddRecordToGrid: Error " & Err.Number & " - " & Err.Description
End Sub
Private Sub SetupGrid()
   
    On Error GoTo ERR_HANDLER
   
    With grdSample
       
        'Set Grid Properties
        .AllowEdit = True
        .FocusSubItems = True
   
        'Clear grid before populating
        .Records.DeleteAll
        .Columns.DeleteAll
        'Add Columns
        .Columns.Add 0, "ID", 20, False
        .Columns.Add 1, "User", 80, False
        .Columns.Add 2, "Notes", 200, False
       
        'Set which columns can be edited
        .Columns(0).Editable = False
        .Columns(1).Editable = True
        .Columns(2).Editable = True
       
        'Add combo to required columns
        .Columns(1).EditOptions.AddComboButton
       
    End With
   
    Exit Sub
   
ERR_HANDLER:
   
    MsgBox "Error in Form1.frm::Sub SetupGrid: Error " & Err.Number & " - " & Err.Description
   
End Sub
Private Sub grdSample_FocusChanging(ByVal NewRow As XtremeReportControl.IReportRow, ByVal NewColumn As XtremeReportControl.IReportColumn, ByVal NewItem As XtremeReportControl.IReportRecordItem, Cancel As Boolean)
   
    On Error GoTo ERR_HANDLER
   
    If NewColumn.Index = 1 Then
       
        NewItem.CreateEditOptions
       
        NewItem.EditOptions.ConstraintEdit = True
       
        NewItem.EditOptions.Constraints.DeleteAll
        NewItem.EditOptions.RemoveButtons
        NewItem.EditOptions.AddComboButton
      
        NewItem.EditOptions.Constraints.Add "Line 1", 0
        NewItem.EditOptions.Constraints.Add "Line 2", 1
        NewItem.EditOptions.Constraints.Add "Line 3", 2
       
        grdSample.Redraw
       
    End If
   
    Exit Sub
   
ERR_HANDLER:
   
    MsgBox "Error in Form1.frm::Sub grdSample_FocusChanging: Error " & Err.Number & " - " & Err.Description
   
End Sub

Back to Top
eswohnai View Drop Down
Newbie
Newbie
Avatar

Joined: 11 July 2008
Location: United Kingdom
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote eswohnai Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2008 at 9:01am
I've now managed to work around this.
 
The work round was to the add the following routine.
 
Thanks for your help
 
>>>>>>>>>>>>>>>>>>>>>
Private Sub grdSample_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
   
    On Error GoTo ERR_HANDLER
   
    If Column.Index = 1 Then
       
        Item.Caption = Item.EditOptions.Constraints(Item.Value).Caption
       
    End If
   
    Exit Sub
   
ERR_HANDLER:
   
    MsgBox "Error in Form1.frm::Sub grdSample_ValueChanged: Error " & Err.Number & " - " & Err.Description
   
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.203 seconds.