Print Page | Close Window

Checkbox + AllowEdit (Strange Behavour)

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=16105
Printed Date: 15 November 2024 at 11:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Checkbox + AllowEdit (Strange Behavour)
Posted By: choochy
Subject: Checkbox + AllowEdit (Strange Behavour)
Date Posted: 29 January 2010 at 8:42pm

I have a report control setup with a couple of columns that I need to be just checkboxs, the rest of the columns are text.

I have enabled editable on the report control and set any columns that I dont want to be editable as false. I have added the checkboxs (using Item.HasCheckbox = True) but this is where the functionality gets strange.
 
The checkbox itself works fine as a checkbox and tickes and untickes, however if u click next to the checkbox (still in the column) it goes in to text editing mode. Example:
 

 
From memory, the previous version didnt work like this. How can stop this behavour? I only want the checkbox to be edited and not the text within.
 
Thanks
 
Chris


-------------
Product: Xtreme SuitePro (ActiveX) version 13.4.2
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 & Delphi XE



Replies:
Posted By: @lin
Date Posted: 23 February 2010 at 11:19am
I am also interested in a way to solve this issue. Any solution? (besides the one to use pictures emulating checkboxes instead of checkboxes)


Posted By: jpbro
Date Posted: 23 February 2010 at 11:42am
If you set ReportControl.EditOnClick = False, does it still happen?

If you provide a small sample, I can experiment a bit to try and find a solution.

One thing I notice is that there is no CancelEdit or FinishEditing method like some other grids I use - this would be nice.

Even nicer would be a BeforeEdit(Cancel As Boolean) event that allows you to prevent editing based on any arbitrary conditions that you may have, but I don't see an event like this either.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 23 February 2010 at 11:47am
Okay, there is a RequestEdit event, which fires before the edit window appears and allows you to cancel editing. Can you test for your column there and then set Cancel = True?

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 23 February 2010 at 2:27pm
Hi,
 
I can't find a workaround and it seems we need a fix for this before new release.
This was working OK in previous versions.
 
Mark, please fix this for V14.0
 
 
 


-------------
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: jpbro
Date Posted: 23 February 2010 at 3:47pm
IMHO, I think RequestEdit should only fire before the Edit box is going to be shown - that way you could still change the checkbox state, and prevent editing of the cell value by setting Cancel = True.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 23 February 2010 at 4:12pm
Here's a workaround if you are desperate for something until a proper fix is issued:

General section:

Private Declare Function SendMessageLong Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE As Long = &H10


Code (adjust for the name of your reportcontrol as required)

Private Sub ReportControl1_BeginEdit(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
   If Item.HasCheckbox Then
      ' Close the cell editor if item has a checkbox
      SendMessageLong Me.ReportControl1.InplaceEditHwnd, WM_CLOSE, 0, 0
   End If
End Sub



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: choochy
Date Posted: 23 February 2010 at 6:30pm
Thanks for the responses guys. Yes I have not seen this problem in previous releases either.
 
While this is not a good work around, I was able to get what I wanted by setting ReportGrid.AllowEdit = False. Lucky for me the only editable items in my lists are checkboxes.
 
I hope that this is fix soon.


-------------
Product: Xtreme SuitePro (ActiveX) version 13.4.2
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 & Delphi XE


Posted By: SuperMario
Date Posted: 25 February 2010 at 7:57pm
Originally posted by jpbro jpbro wrote:

IMHO, I think RequestEdit should only fire before the Edit box is going to be shown - that way you could still change the checkbox state, and prevent editing of the cell value by setting Cancel = True.


Cancel = True will cancel any changes made in request edit, so that wont work.

I decided to add Item.CanEditCheckboxItem property to not break existing functionality.  So incase someone actually wants to allow check box items to be edited they will be allowed to.

Set Item.CanEditCheckboxItem = False and you are good to go :)

**edit** I made False the default setting after checking an older version  (12.1.1) and seeing that even with the item set to editable it would not display an edit control.


Posted By: choochy
Date Posted: 26 February 2010 at 6:21am
Excellent. Thanks!

-------------
Product: Xtreme SuitePro (ActiveX) version 13.4.2
Platform: Windows 7 (32bit)
Language: Visual Basic 6.0 & Delphi XE


Posted By: Michael S.
Date Posted: 16 June 2010 at 4:29am
Just another way to do it, as I just had the same problem. You can also set the column EditOptions like this:

rcCol.EditOptions.AllowEdit = False

This will also allow checkbox editing, but no text editing.



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