Symptom
How to disable the mouse click in a TreeView control on checkbox for each treeview item.
Environment
PowerBuilder
Solution
1. Create a function:
wf_set_checkbox_state (long al_tvihandle, long al_state) { treeviewitem ltvi tv_1.GetItem ( al_tvihandle, ltvi) ltvi.statepictureindex = al_state tv_1.SetItem ( al_tvihandle, ltvi ) }
2. In the Clicked Event of the treeview add this code:
long ll_state treeviewitem ltvi tv_1.GetItem ( handle, ltvi) ll_state = ltvi.statepictureindex post wf_set_checkbox_state (handle, ll_state)
3. Create a user event mapped to pbm_keydown and put in it this code:
if keyflags = 0 and key = KeySpacebar! then return 1