Is there a way of distinguishing between when a user clicks on a control, and a Click (or other events like Change or whatever) that are generated when some code is executed that fires the event (such as when you change the ListIndex of a combo box and its Click event is automatically fired)?
I got round this in a rather inelegant way of setting a property to 1 in the line of code just before I wrote the line that fires the Click event automatically. Then when the Click event of the control is fired, it can interrogate the property I set and 'know' that this was a code-generated event and not a user-generated event.
gObjSession.ValueChangedInCode = gObjSession.ValueChangedInCode + 1
frmMain.treMain.SelectedItem.Expanded = True
gObjSession.ValueChangedInCode = gObjSession.ValueChangedInCode - 1
There must be a more elegant way than this!
I got round this in a rather inelegant way of setting a property to 1 in the line of code just before I wrote the line that fires the Click event automatically. Then when the Click event of the control is fired, it can interrogate the property I set and 'know' that this was a code-generated event and not a user-generated event.
gObjSession.ValueChangedInCode = gObjSession.ValueChangedInCode + 1
frmMain.treMain.SelectedItem.Expanded = True
gObjSession.ValueChangedInCode = gObjSession.ValueChangedInCode - 1
There must be a more elegant way than this!