Hi Andrea et al,
When using a HyperTreeList with check boxes and without images the
HitTest for checking whether the user clicked the check box is a bit
off horizontally. If I click clearly on the left of a checkbox it gets
checked. If I click in the checkbox, but on the right side, nothing
happens. I think this part of HitTest is not quite right:
# check for hit on the check icons
wcheck = 0
if theCtrl._checkWidth > 0:
chkX = self._text_x - theCtrl._imgWidth -
3*_MARGIN - theCtrl._btnWidth
chkY = y_mid - theCtrl._checkHeight2
if ((point.x >= chkX) and (point.x <= (chkX +
theCtrl._checkWidth)) and
(point.y >= chkY) and (point.y <= (chkY +
theCtrl._checkHeight))):
flags |= TREE_HITTEST_ONITEMCHECKICON
return self, flags, maincol
(BTW, wcheck is not used in HitTest below these lines so the 'wcheck =
0' can be removed)
I guess " chkX = self._text_x - theCtrl._imgWidth - 3*_MARGIN -
theCtrl._btnWidth" is not correct. I'd like to create a patch, but I
don't understand a few things here:
- Why doesn't the number of times the _MARGIN gets deducted (the 3)
depend on whether or not there is an image?
- Why is the _btnWidth deducted? The button is on the left of the text
and the checkbox, right?
- Why isn't the _checkWidth deducted?
Thanks, Frank
Hi Frank,
Hi Andrea et al,
When using a HyperTreeList with check boxes and without images the
HitTest for checking whether the user clicked the check box is a bit
off horizontally. If I click clearly on the left of a checkbox it gets
checked. If I click in the checkbox, but on the right side, nothing
happens. I think this part of HitTest is not quite right:
\# check for hit on the check icons
wcheck = 0
if theCtrl\.\_checkWidth > 0:
chkX = self\.\_text\_x \- theCtrl\.\_imgWidth \-
3*_MARGIN - theCtrl._btnWidth
chkY = y_mid - theCtrl._checkHeight2
if ((point.x >= chkX) and (point.x <= (chkX +
theCtrl._checkWidth)) and
(point.y >= chkY) and (point.y <= (chkY +
theCtrl._checkHeight))):
flags |= TREE_HITTEST_ONITEMCHECKICON
return self, flags, maincol
(BTW, wcheck is not used in HitTest below these lines so the 'wcheck =
0' can be removed)
I guess " chkX = self._text_x - theCtrl._imgWidth - 3*_MARGIN -
theCtrl._btnWidth" is not correct. I'd like to create a patch, but I
don't understand a few things here:
- Why doesn't the number of times the _MARGIN gets deducted (the 3)
depend on whether or not there is an image?
- Why is the _btnWidth deducted? The button is on the left of the text
and the checkbox, right?
- Why isn't the _checkWidth deducted?
I have seen your message, at the moment I am a bit short of time to
come up with a sample and then hack for a solution. It will not be
difficult to fix, I am sure. I'll try to fix it in the next few days,
unless you come up with a patch
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On Tue, May 5, 2009 at 10:14 AM, Frank Niessink wrote:
Hi Andrea,
I have seen your message, at the moment I am a bit short of time to
come up with a sample and then hack for a solution. It will not be
difficult to fix, I am sure. I'll try to fix it in the next few days,
unless you come up with a patch
Sure, no problem, I can try to fix it. If you have a little time to
answer my questions that would help.
[Original message repeated for your convenience:]
When using a HyperTreeList with check boxes and without images the
HitTest for checking whether the user clicked the check box is a bit
off horizontally. If I click clearly on the left of a checkbox it gets
checked. If I click in the checkbox, but on the right side, nothing
happens. I think this part of HitTest is not quite right:
# check for hit on the check icons
wcheck = 0
if theCtrl._checkWidth > 0:
chkX = self._text_x - theCtrl._imgWidth -
3*_MARGIN - theCtrl._btnWidth
chkY = y_mid - theCtrl._checkHeight2
if ((point.x >= chkX) and (point.x <= (chkX +
theCtrl._checkWidth)) and
(point.y >= chkY) and (point.y <= (chkY +
theCtrl._checkHeight))):
flags |= TREE_HITTEST_ONITEMCHECKICON
return self, flags, maincol
(BTW, wcheck is not used in HitTest below these lines so the 'wcheck =
0' can be removed)
I guess " chkX = self._text_x - theCtrl._imgWidth - 3*_MARGIN -
theCtrl._btnWidth" is not correct. I'd like to create a patch, but I
don't understand a few things here:
- Why doesn't the number of times the _MARGIN gets deducted (the 3)
depend on whether or not there is an image?
- Why is the _btnWidth deducted? The button is on the left of the text
and the checkbox, right?
- Why isn't the _checkWidth deducted?
Cheers, Frank
···
2009/5/7 Andrea Gavana <andrea.gavana@gmail.com>:
Patch attached.
Cheers, Frank
hypertreelist_hittest.txt (2.33 KB)
···
2009/5/5 Frank Niessink <frank@niessink.com>:
Hi Andrea et al,
When using a HyperTreeList with check boxes and without images the
HitTest for checking whether the user clicked the check box is a bit
off horizontally. If I click clearly on the left of a checkbox it gets
checked. If I click in the checkbox, but on the right side, nothing
happens. I think this part of HitTest is not quite right:
\# check for hit on the check icons
wcheck = 0
if theCtrl\.\_checkWidth > 0:
chkX = self\.\_text\_x \- theCtrl\.\_imgWidth \-
3*_MARGIN - theCtrl._btnWidth
chkY = y_mid - theCtrl._checkHeight2
if ((point.x >= chkX) and (point.x <= (chkX +
theCtrl._checkWidth)) and
(point.y >= chkY) and (point.y <= (chkY +
theCtrl._checkHeight))):
flags |= TREE_HITTEST_ONITEMCHECKICON
return self, flags, maincol
(BTW, wcheck is not used in HitTest below these lines so the 'wcheck =
0' can be removed)
I guess " chkX = self._text_x - theCtrl._imgWidth - 3*_MARGIN -
theCtrl._btnWidth" is not correct. I'd like to create a patch.