PDA

View Full Version : cSigCJReportControl with Multiple Checkboxes



HenryEgal
11-May-2010, 02:23 PM
Hello there, I am using this control with 9 different checkboxes. I am able to tell when an item is checked or unchecked using: Procedure OnComItemCheck Variant llRow Variant llItem
but I am having trouble telling what column was just checked or unchecked. I want to do different things after each check. Is there an easy way to get the current column of box that was just checked?

Thanks for any info!
Henry

chuckatkinson
12-May-2010, 07:49 AM
Hello there, I am using this control with 9 different checkboxes. I am able to tell when an item is checked or unchecked using: Procedure OnComItemCheck Variant llRow Variant llItem
but I am having trouble telling what column was just checked or unchecked. I want to do different things after each check. Is there an easy way to get the current column of box that was just checked?

Thanks for any info!
Henry

Wow 9 checkboxes ! I was happy to get one to work so far :)

Anyway, maybe there is a better way but here is how I am doing this ...



Procedure OnComMouseUp Short llButton Short llShift Integer llx Integer lly
Handle hoHitTest hoCol
Variant vHitTest vCol
Integer iHitCode iCol
String sCaption

Get phoReportColumn to hoCol

Get Create U_cSigCjComReportHitTestInfo to hoHitTest

Get ComHitTest llx lly to vHitTest
Set pvComObject of hoHitTest to vHitTest

Get ComHt of hoHitTest to iHitCode

If (iHitCode=OLExtpHitTestHeader) Begin
Get ComColumn of hoHitTest to vCol

If (not(IsNullComObject(vCol))) Begin // Not a blank column
Set pvComObject of hoCol to vCol
Get ComCaption of hoCol to sCaption
If ((Trim(sCaption))="") Begin
Send Select_All
End
End
End

Send Destroy of hoHitTest

End_Procedure


The above code detects if the user clicked on the header and then finds the column. The Hittest returns different codes whether it was the header, column or footer.

HTH

Can I ask a favor ? Can you post some sample code on how you are using the OnComItemCheck. I'm not familiar with this message.

Thanks

Ian Smith
12-May-2010, 08:20 AM
The ComIndex of llIem is the column creation order (zero based) and is the same as ComItemIndex of a ReportColumn. (The ComIndex of the ReportColumn is the display order.)

HenryEgal
13-May-2010, 08:45 AM
Ian thanks! ComIndex is what I was looking for.
Chuck Ian had posted this sample code for OnComItemCheck before. It is fired anytime you tick a checkbox:


Procedure OnComItemCheck Variant llRow Variant llItem
Boolean bChecked
Handle hoRow hoItem hoRec
Variant vRec
Integer iIndex iId iCheck
String sID
String[] sSelected_Rows
tEnroll_List[] ltEnroll_List

//Link to the Row object and get the Record object
Get phoReportRow to hoRow
Set pvComObject of hoRow to llRow
Get ComRecord of hoRow to vRec

//Link to the Record object and get the unique ID for the row
Get phoReportRecord to hoRec
Set pvComObject of hoRec to vRec
Get ComTag of hoRec to sID

//Link to the Item object and get the checked state
Get phoReportRecordItem to hoItem
Set pvComObject of hoItem to llItem
Get ComChecked of hoItem to bChecked


Get ptEnroll_List to ltEnroll_List

Move sID to iID
Move (iID - 1) to iID
Move bChecked to iCheck

Move iCheck to ltEnroll_List[iID].iChecked
Set ptEnroll_List to ltEnroll_List

End_Procedure

Thank you both for the support!
Henry