Print Page | Close Window

Change Caption causes Focus problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=9649
Printed Date: 08 October 2024 at 8:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Change Caption causes Focus problem
Posted By: cgaskill
Subject: Change Caption causes Focus problem
Date 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?



Replies:
Posted By: cgaskill
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net