following focus

Is there a way to determine what is changing the focus in an app window. I am working on an app for a client that whenever the entry selection in a listbox (people) changes, it changes the data in a container control (displays’ a persons details). and the focus goes somewhere. What is the best way to track down where is the code that forces the focus to change and to where?

This is driving me nuts. When I click on a person, their data is displayed but I want to be able to use arrow keys (up/down) to select the one above/below it. but the focus is gone. And I am losing more hair (if that is possible).

thanks
sb

[quote=341174:@scott boss]Is there a way to determine what is changing the focus in an app window. I am working on an app for a client that whenever the entry selection in a listbox (people) changes, it changes the data in a container control (displays’ a persons details). and the focus goes somewhere. What is the best way to track down where is the code that forces the focus to change and to where?

This is driving me nuts. When I click on a person, their data is displayed but I want to be able to use arrow keys (up/down) to select the one above/below it. but the focus is gone. And I am losing more hair (if that is possible).

thanks
sb[/quote]
Start by figuring out where the focus goes on that window. Put a timer and a label on the window and in the action event, set the label to

TempLabel.Text = self.focus.name

Once you know the control, put a breakpoint in its GotFocus event.

[quote=341280:@Greg O’Lone]Start by figuring out where the focus goes on that window. Put a timer and a label on the window and in the action event, set the label to

TempLabel.Text = self.focus.name

Once you know the control, put a breakpoint in its GotFocus event.[/quote]

thanks!! I will start there.

[quote=341280:@Greg O’Lone]

TempLabel.Text = self.focus.name

Very useful, thanks. One necessary tweak:

if self.focus <> Nil then TempLabel.Text = self.focus.name else TempLabel.Text = "Nil"