Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox Bug?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
Listbox Bug?
Divers
Thread ID:
00922603
Message ID:
00922603
Vues:
50
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

** For testing
**WAIT WINDOW TRANSFORM(.lstFiles.ListIndex)	

** .lstFiles.SetFocus()

	
  .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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform