Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QMGrid questions
#5
From the original question in this post (how to fill in regular dialog fields from a selected from in a qmgrid in that dialog), I have been successful with text fields but am having trouble with checking and unchecking checkboxes based on the contents of a specific field in the selected row of the qmgrid.


The code I have will check a checkbox if the field is positive but for some reason gives a Can Not Find Item error when it has to uncheck the box. Very strange.


In the gridNotify dialog for the dialog with the qmGrid, I have the following code

Macro
Code:
Copy      Help
str QmGridFieldResult
LvGetItemText QmGridHwnd RowNumber 13 QmGridFieldResult;err ;; get whether column 13 in the selected row is empty or has a "*"
if QmGridFieldResult="*";; checkbox should be checked
,Acc Checkbox=acc("Sample Checkbox" "CHECKBUTTON" DlgHwnd "Button" "" 0x1000)
,int CheckboxState=Checkbox.State()
,if(CheckboxState&STATE_SYSTEM_CHECKED);; leave checked if already checked or check if unchecked
,,out "already checked";; do nothing
,else
,,Checkbox.Mouse(1);; check checkbox
else
,out "not checked";; checkbox should be unchecked or left unchecked
,Checkbox=acc("Sample Checkbox" "CHECKBUTTON" DlgHwnd "Button" "" 0x1000)
,CheckboxState=Checkbox.State()
,if(CheckboxState&STATE_SYSTEM_CHECKED);;if checked, then uncheck it
,,Checkbox.Mouse(1)

Note that this is triggered by a

Function AttendingComments_gridNotify
Code:
Copy      Help
,case LVN_ITEMCHANGED
,,NMLISTVIEW* nlv=+nh
,,if(nlv.iItem<0 or nlv.uNewState&LVIS_SELECTED=0) ret
,,int RowNumber =  nlv.iItem ;;selected listview item index

Any thoughts or advice would be great.
Thanks so much!

Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)