Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What Can Cause Object to Lose Focus?
Message
De
10/08/2001 13:17:59
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
07/08/2001 14:31:52
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00540817
Message ID:
00542398
Vues:
23
>Renoir-
>
>>My next step is to start breaking apart the combobox class, but this will be an effort as it was initially built from someone else's class and modified to work in my particular situation. I was hoping by understanding what might cause an object to lose focus I could limit the scope of my troubleshooting.
>
>I think this is probably best. It sounds like the combo is overloaded. Otherwise you're taking stabs in the dark. And what we say generally may or may not have anything to do with how your code is working. That's pretty frustrating for everybody. If a combobox is too complicated to follow it's events, then it's design had probably gotten out of control. It might be that it needs to be an abstract class with some functionality with a concrete class with other functionality.
>
>No need to split it out, though. You could either 1) start from the ground up. Probably first by listing the things the combobox needs to accomplish. Think of it as an abstract object and not a specific implementation (a combobox is a specific implementation). Or you could 2) create generic combobox class and gradually add in the functionality you need, carefully testing as you go.
>
>I think you'll be happier in the long run, and it will probably be easier to maintain, even if it seems like too much work in the short run.

Nancy,

I'm going to post a version of the following in other threads I've started recently as it addresses those issues as well.

The solution to the combobox/focus problem had a lot to do with a very simple thing. As I broke it apart and started doing some research I found a very obvious reason that it wouldn't hold focus. The Enabled was initially set to False and only when it was refreshed would it be set to True and accept the focus. Since it was on a different page, and ThisForm.Refresh will only affect the current active page, the combobox.Enabled was not reset to True until that page was refreshed. This also expains why there was a difference when the form ran the first time as opposed to any subsequent time. It also reacted differently depending on whether ActivePage or SetFocus was called first. By my recent experience, ActivePage should be set first.

Thank you all for your input. I'm afraid I made the problem appear much more complex than it was and in the process throwing you all off the scent...

Bottom line: Make sure an object is Enabled before setting focus to it.

Renoir
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform