Focus/Activation

Started by Richard Kelly, April 26, 2010, 04:27:40 AM

Previous topic - Next topic

Richard Kelly

After I open a form with it's Show function, I cannot figure out how to have that newly opened non-modal form have keyboard focus. I have tried every combination of FF_Control_ShowState and even tried SetActiveWindow. Setting focus on a control on the new form doesn't do anything either. I can click on the window and then it gets focus but want to avoid that extra step. What say you window wizards?

I got it....PostMessage with %WM_SETFOCUS does the trick....

Rolf Brandt

Hmm.., usually the new form should have the focus automatically. But maby I didn't understand the problem properly.

I added a minimum project with two forms. Form1 has a button to whow Form2. Form2 has a textbox. When you open Form2 (modal or nonmodal) the textbox on Form2 has the focus.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Richard Kelly

The forms I was having issues with use listviews and buttons. The listview is at the top of the tab order and the first row is shown as selected but the form did not have the focus. %WM_SETFOCUS works on these forms....I never expected such a quick response at this hour.... 8)

Rolf Brandt

Response probably has to do with location - it is 10:00 am here (Germany).

Remember - the sun never sets in the FireFly Kingdom. (...or was that another kindgom?)
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Richard Kelly

Midnight in Alaska, USA at 61 degrees north latitude where it is quickly getting to the point where the sun will still be up.... :D