Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Splitter » Background of items in splitter is sometimes is incorrectly painted black
Background of items in splitter is sometimes is incorrectly painted black [message #56445] Fri, 12 March 2021 14:26
Maginor is currently offline  Maginor
Messages: 44
Registered: May 2019
Member

Edit: Never mind, the error seems to be fixed when I make TopPanel and BottomPanel inherit from ParentCtrl instead of Ctrl.

Hi,
In the below example, if you hover over the option, it's background becomes black.
If you push the button, which changes the text of the label, the background of the label becomes black.

index.php?t=getfile&id=6392&private=0

SplitterBackgroundBug.h :
#ifndef _SplitterBackgroundBug_SplitterBackgroundBug_h
#define _SplitterBackgroundBug_SplitterBackgroundBug_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <SplitterBackgroundBug/SplitterBackgroundBug.lay>
#include <CtrlCore/lay.h>


class TopPanel : public WithTopPanelLayout<Ctrl> {
public:
	TopPanel();
};

class BottomPanel : public WithBottomPanelLayout<Ctrl> {
public:
	BottomPanel();
};

class SplitterBackgroundBug : public TopWindow {
public:
	SplitterBackgroundBug();
	
	
	void ButtonPushed();
	
private:
	TopPanel toppanel;
	BottomPanel bottompanel;
	Splitter split;
};

#endif



SplitterBackgroundBug.lay :
LAYOUT(TopPanelLayout, 292, 28)
	ITEM(Upp::Option, myopt, SetLabel(t_("An option")).LeftPosZ(8, 72).TopPosZ(4, 16))
END_LAYOUT

LAYOUT(BottomPanelLayout, 412, 28)
	ITEM(Upp::Button, mybutton, SetLabel(t_("Push this")).LeftPosZ(4, 56).TopPosZ(4, 15))
	ITEM(Upp::Label, mylabel, SetLabel(t_("This label changes when you push the button")).LeftPosZ(64, 340).TopPosZ(4, 19))
END_LAYOUT


main.cpp :
#include "SplitterBackgroundBug.h"

SplitterBackgroundBug::SplitterBackgroundBug()
{
	Title("Click the button");
	SetRect(0, 0, 400, 200);
	Sizeable();
	
	split.Vert();
	split.Add(toppanel);
	split.Add(bottompanel);
	Add(split.SizePos());
	
	bottompanel.mybutton.WhenPush = [this](){ ButtonPushed(); } ;   // THISBACK(ButtonPushed); //<- doesn't work for some reason...
}

void SplitterBackgroundBug::ButtonPushed()
{
	bottompanel.mylabel.SetText("The button was pushed");
}

TopPanel::TopPanel()
{
	CtrlLayout(*this);
}

BottomPanel::BottomPanel()
{
	CtrlLayout(*this);
}


GUI_APP_MAIN
{
	SplitterBackgroundBug().Run();
}

[Updated on: Fri, 12 March 2021 15:25]

Report message to a moderator

Previous Topic: Bug: adding HScrollBar uses sbar as item
Goto Forum:
  


Current Time: Thu Apr 18 11:53:06 CEST 2024

Total time taken to generate the page: 0.01454 seconds