Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grid: output row, disable rightclick, set checkbox state
#1
Question 1

I have a problem with the below code, which is a more simplified version of the "sample_Grid_images"
The problem lies with the line which contains the following code: out row => (when user LEFT clicks on checkbox or cell/row)
The first time you LEFT click on a cell/row, the output behaves exactly like expected.
After the second time it displays 3 values. (one of which beeing negative).
EXAMPLE: LEFT click on the cell called "checked" after that LEFT click on the cell called "two"
You should see 3 values.

This happens when the following Grid properties are un-set:

properties:
- User cannot edit/first column

properties >> More styles...:
- More space to click checkbox
- LVS_EX_AUTOSIZECOLUMS (Vista/7/8)

If I set the above Grid properties, the LEFT click behavior returns to normal.
The problem still remains when RIGHT clicking.
For example: RIGHT click on "checked" and while the right-click menu is displaying, RIGHT click on "two"
you will probably see 3 values in stead of one.


Function dd
Code:
Copy      Help
\Dialog_Editor

function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "4"
str qmg4x

qmg4x=
;one
;two
;<////2>checked

if(!ShowDialog("" &dd &controls _hwndqm)) ret

;BEGIN DIALOG
;0 "" 0x90C80A48 0x100 0 0 96 106 "QM_Grid"
;4 QM_Grid 0x56831041 0x0 18 14 64 78 "0x36,0,0,4,0x840[]A,,,"
;END DIALOG
;DIALOG EDITOR: "" 0x2040105 "*" "" "" ""

ret
;messages
DlgGrid g.Init(hDlg 3)
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret

;messages2
sel wParam
,case IDOK
ret 1


;messages3
NMHDR* nh=+lParam
NMITEMACTIVATE* na=+nh
sel nh.idFrom
,case 4
,sel nh.code
,,case LVN_ITEMCHANGED
,,int row isChecked
,,;if(g.RowIsCheckNotification(lParam row isChecked)) out "%schecked %i" iif(isChecked "" "un") row
,,g.RowIsCheckNotification(lParam row isChecked)
,,out row    ;; This outputs 3 values AFTER the first click (same for na.iItem)    
,,case NM_RCLICK            
,,,ret 1

Is there a way to have the right-click behaviour corrected?
With this I mean, having the right-click functionality on a grid but with normal row output behaviour?

Question 2
Is there a way to disable the RIGHT click on a cell/row in a grid?
I tried "NM_RCLICK" with "ret 1" but it still displays rightclick menu

Question 3
What is the correct syntax to SET and UNSET a checkbox state in a grid through a button?
If user clicks on button in a dialog, a check box in the grid gets checked / unchecked.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)