What is the best way to get the next TabIndex number?

  • Thread starter Thread starter tribbles
  • Start date Start date
T

tribbles

I have a fun problem in that when I copy and paste controls in my
designer applciation I get duplicate tab indexes. In order to help the
user out I want to know wha tthe highest tab index is on the screen and
then increment it for the newly pasted controls. Sicne users can
delete cotnrols, there is no guarantee that just a count of the number
of controls will give the correct max tab index in play and I dislike
having to search through all the controls on the screen to jsut do a
count or to get the max... Is there an easier way? Is there an MS
tab index service for generating tab indexes?
 
You could maintain your own records... keep the highest tab index
inserted so far. However, that's fallible. Compared against the user's
reaction time and their perception of events, I'll be that simply using
the brute force method: walking the control hierarchy and finding the
maximum tab index each time will be so fast that nobody will notice it
happening. Brute force is also the surest method: you know for a fact
that you'll always get the correct maximum.

Try the brute force method first, then introduce fancy record-keeping
only if it proves unsatisfactory.
 
I agree with Bruce... Brute force method is the way to go !

Always knew there was something brutish about me !! ;-)

Regards,

Cerebrus.
 
Back
Top