Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to read userselected constraints
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to read userselected constraints

 Post Reply Post Reply
Author
Message
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post Topic: How to read userselected constraints
    Posted: 22 April 2006 at 6:49am

If I have added a contstraint to the first column of the reportcontrol like this:

    Column.EditOptions.AddComboButton
    Column.EditOptions.Constraints.Add "Phone", 1
    Column.EditOptions.Constraints.Add "Email", 2
    Column.EditOptions.Constraints.Add "Homepage", 3


now i want to get the user selection for an item in the reportcontrol-list with about 15 lines.

for reading the user value i am working like this

Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)

   'this part works fine, if not constraints exists in column object
   Msgbox Item.Caption

   'now i'd like to read the user input, when a Constraints Dropdowncombo exists like
   Msgbox Item.SelectedConstraints.Value ?

End Sub

Kind regards

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2006 at 7:16am
Hi,

Iterate editing constraints you can in a following way, depending whether you set them for a column or for an item:

Dim c As ReportRecordItemConstraint
For Each c In Item.EditOptions.Constraints ' or wndReport.Columns(column_index).EditOptions.Constraints
    Debug.Print c.Caption
Next


--
WBR,
Serge
Back to Top
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2006 at 7:37am

Hi,

thanx for your answer, the constaints are defined for each column. How can i get the currently selected Constaint of the item, the user is editing?

kind regards
Markus

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2006 at 7:51am
Just iterate constraints for an appropriate column, which index is an item index. See below:


For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
    Debug.Print c.Caption
Next


--
WBR,
Serge

Back to Top
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2006 at 8:28am

hi,
thank you for your reply, but your the returned array is empty so the debug.print will not be fired.

I fill the column constraints as follows:

        Set Column = Me.wndReportControl.Columns.Add(1, "Typ", 150, True)
        Column.EditOptions.AddComboButton
        Column.EditOptions.Constraints.Add "Phone", 1
        Column.EditOptions.Constraints.Add "Email", 2
        Column.EditOptions.Constraints.Add "Homepage", 3

I have tried the following code:
Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)

For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
    Debug.Print c.Caption  '<= there's no debugger output
Next

End Sub

i am working with Codejock XTreme Suite Pro ActiveX V9.81
thank you for your support
Kind regards
Markus

Back to Top
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2006 at 3:53am

oh sorry, i have currently checked, that this is the wrong forum for activex com  .

i'd be very pleased, if you can send me a code sample

kind regards
Markus

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2006 at 2:13pm
in your sample code, it fires ValueChanged if you change any item, but you should iterate constraints for your "Typ" column item. So far, it should be working if you change it in a following way:

Set Column = Me.wndReportControl.Columns.Add(1, "Typ", 150, True)
Column.EditOptions.Constraints.Add "Phone", 1
Column.EditOptions.Constraints.Add "Email", 2
Column.EditOptions.Constraints.Add "Homepage", 3

Column.EditOptions.AddComboButton



Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
 If Item.Index = 1 Then
  For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
      Debug.Print c.Caption
  Next
 End If

End Sub



My previous piece of code works fine if you insert it into standard ReportSample, _ValueChanged handler.

If it still doesn't work for you, try attaching your sample and I'll check it up.

--
WBR,
Serge
Back to Top
cmaxmedia View Drop Down
Groupie
Groupie


Joined: 22 April 2006
Location: Austria
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmaxmedia Quote  Post ReplyReply Direct Link To This Post Posted: 27 April 2006 at 2:57am

Hi, It works!!

i am working with adodb.7 recordsets to fill the user data into the report as follows:



Set Record = .Records.Add
Set Item = Record.AddItem("")
            
Set Item = Record.AddItem(CStr(MyRS("strCommunicationType")))
Item.Caption = CStr(MyRS("strCommunicationType"))

Set Item = Record.AddItem(MyRS("strValue"))
Item.Caption = MyRS("strValue")

Set Item = Record.AddItem("")
Item.Caption = NZ("")

Set Item = Record.AddItem(MyRS("ysnMain"))
Item.HasCheckbox = True
Item.Checked = MyRS("ysnMain")

Record.AddItem ""
Record.PreviewText = MyRS("ID")
Record.Tag = MyRS("ID")

take a look at the code line 3 and 4. now i am using the cstr() vb-command AND => it works

Thank you for your support.
markus

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