I have a listbox and the user clicks an Add button to select files to add
the the list.
The Remove button's click event calls this code:
LOCAL cFileName, cMessage
WITH ThisForm
cFileName = .lstFiles.List(.lstFiles.ListIndex)
cMessage = "Remove file '" + cFileName + "'?"
IF MESSAGEBOX(cMessage,4+32+256) = 6
.lstFiles.RemoveItem(.lstFiles.ListIndex)
ENDIF
.cmdBegin.Enabled = (.lstFiles.ListCount > 0)
.cmdRemove.Enabled = (.lstFiles.ListIndex > 0)
ENDWITH
RETURN
If I add 3 files, then select file 2 and click Remove, the item is removed and the
highlight bar moves to the next list item, which is now 2.
But the last line of code, to ensure that the Remove button is enabled, doesn't work.
The ListIndex is 0, so the button is not enabled. But the item Is highlighted.
If I step through in the debugger, works fine. If you uncomment the WAIT WINDOW, you
see that the ListIndex is zero.
If I uncomment the SetFocus, it works fine.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people