Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Change Caption causes Focus problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Change Caption causes Focus problem

 Post Reply Post Reply
Author
Message
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post Topic: Change Caption causes Focus problem
    Posted: 20 February 2008 at 10:36am
I have ran into a situation when if I change the caption of a Menu/Toolbar it causes the current window to lose focus.

Do to my requirements we need to change the Caption and Tooltip of a Menu/Toolbar control depending on the current state of an item in the list box.  However, as soon as we change the caption, that list box loses focus so the user is no longer able to arrow up/down without click back in the list box.

Is there a way to change the caption text without triggering this focus issue?
Back to Top
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2008 at 11:33am
The following work around worked for my situation.

Dim hwndFocus As Long

hwndFocus = GetFocus() ' Win32 API call
Control.Caption = 'New Caption'
CommandBars.RecalcLayout
If hwndFocus > 0 Then
  Call SetFocus(hwndFocus) ' Win32 API call
EndIf
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.