Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DoScroll
Message
De
26/03/2004 13:35:59
Walter Meester
HoogkarspelPays-Bas
 
 
À
26/03/2004 06:31:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00889667
Message ID:
00890052
Vues:
35
Hello Marcia,

>I stepped away for using Setfocus() for a long time now because it might trigger all kinds of events depending on what object currently has the focus and might cause an error if a when or valid is in the call stack.

>I am sure that you have your reasons for the way you do things, just as I have mine < s >. I have never had any problem using SetFocus() because I know when to use it and when not to < s >.

Errr, I'm not sure what you'r trying to say here. I do know when I can use setfocus or not. Just outlining that a setfocus could trigger all kinds of unwanted events because you take of the focus of another control that is currently selected. In many cases where the code is triggered by a certain object (e.g. Commandbutton) where the problem cannot occur, but it surely could be a problem when it was trigger from a toolbar button (Save for example) any control on the active form could have the focus.

I wonder how you would implement an interactive search in a grid with this setfocus solution though. You'll have to do a lot of programming to solve the problem that at every keystroke the focus gets of the textbox and you have to position it right again when you get the focus back.

I'm also not sure what you want to say with that you have your ways to do things. I don't think my way or your way is subject to discussion here. Of course everyone has his way to program applications. And you might have a perfect way in avoiding certain issues, but this does not mean that everyone else has the same methology.

I'm sorry that I interupted this discussion to tell everyone how I would approach the problem and what the reasoning is.

>maybe a better approach is to ensure that the active row is at the top with something like:

>Maybe it would be if that is what Jonathon wanted to do. Unfortunately it is not. If you had read his question, you would have realized that what he wanted to do was to display the last full page of records in the grid.

I don't know what you think my code does, but if the record is at the bottom, and you execute my code it will do exactly this. OK, I did hardcode 5 rows to scroll up in stead of calculating the number of rows. But this was not the issue: I was just providing an alternative way for getting the active record on top of the grid. The rest of the problem is just solved with a DOSCROLL method as you already outlined in your example.

Walter,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform