Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TStatusBar font becomes dark at some point, stays dark until text changes


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 29, 2017 2:20 AM Last Post By: John Baird
Val T

Posts: 13
Registered: 6/18/15
TStatusBar font becomes dark at some point, stays dark until text changes  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 29, 2017 2:19 AM
I have a TStatusBar control with four columns in my main form. At some point, when a modal form is opened (this doesn't happen every time, and it happens with many different forms), the font in main form status bar becomes darker (not bold). It stays the same until the text in a column is changed. I am using C++ Builder 10.1. This happens at least on Windows 7 and Windows 10.

Screenshot: http://imgur.com/a/OycBK

How do I fix this?

My code:

UpdateStatusBar() is called from a timer in main form every 50 ms.

void TMainForm::UpdateStatusBar()
{
	const int panelsTotal = StatusBar1->Panels->Count;
	int currentPanel = 0;
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	// Clear panels that were not filled
	for (int i = currentPanel; i < panelsTotal; i++) {
		StatusBar1->Panels->Items[currentPanel]->Text = L"";
	}
}


  object StatusBar1: TStatusBar
    Left = 0
    Top = 637
    Width = 856
    Height = 19
    Panels = <
      item
        Width = 180
      end
      item
        Width = 180
      end
      item
        Width = 180
      end
      item
        Width = 180
      end>
  end
John Baird

Posts: 22
Registered: 6/15/09
Re: TStatusBar font becomes dark at some point, stays dark until text changes
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 4, 2017 2:52 AM   in response to: Val T in response to: Val T
I do not have a solution, but I have seen this issue from time to time over multiple versions of C++Builder. It has always been infrequent and transient, and as I have not detected any pattern to its occurrence, I have not invested any time in attempting to figure it out. Its one of those quirks which each time I upgrade, I hope not to see again.

John

Ville-Valtteri Tiittanen wrote:
I have a TStatusBar control with four columns in my main form. At some point, when a modal form is opened (this doesn't happen every time, and it happens with many different forms), the font in main form status bar becomes darker (not bold). It stays the same until the text in a column is changed. I am using C++ Builder 10.1. This happens at least on Windows 7 and Windows 10.

Screenshot: http://imgur.com/a/OycBK

How do I fix this?

My code:

UpdateStatusBar() is called from a timer in main form every 50 ms.

void TMainForm::UpdateStatusBar()
{
	const int panelsTotal = StatusBar1->Panels->Count;
	int currentPanel = 0;
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	if (/**/) {
		const std::wstring status = /**/
		StatusBar1->Panels->Items[currentPanel]->Text = status.c_str();
		currentPanel++;
	}
 
	// Clear panels that were not filled
	for (int i = currentPanel; i < panelsTotal; i++) {
		StatusBar1->Panels->Items[currentPanel]->Text = L"";
	}
}


  object StatusBar1: TStatusBar
    Left = 0
    Top = 637
    Width = 856
    Height = 19
    Panels =        item
        Width = 180
      end
      item
        Width = 180
      end
      item
        Width = 180
      end
      item
        Width = 180
      end>
  end
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02