Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Color property of Panel and other components #14

Closed
aerilox opened this issue Feb 12, 2022 · 5 comments
Closed

Setting Color property of Panel and other components #14

aerilox opened this issue Feb 12, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@aerilox
Copy link

aerilox commented Feb 12, 2022

Setting Color property of self works ok. Setting Color property of components placed on self does not work. True for all components that have a Color property like Panel, GroupBox aso. Does not work at runtime either. Other properties can be assigned without problem.

	def __init__(self, Owner):
	### object Form
		self.SetBounds(310, 137, 730, 256) #self
		self.Caption = 'Form1'
		self.Color = clSkyBlue  ###colors all components on form, even if ParentColor is set False for each component
		self.Font.Color = clWindowText
		self.Font.Height = -11
		self.Font.Name = 'MS Sans Serif'
		self.Font.Style = []
		self.OldCreateOrder = False
		self.PixelsPerInch = 96
		self.TextHeight = 13
	### object GroupBox1, parent self
		self.GroupBox1 = GroupBox(self)
		self.GroupBox1.Parent = self
		self.GroupBox1.SetBounds(20, 20, 266, 136) #GroupBox1
		self.GroupBox1.Caption = 'GroupBox1'
		self.GroupBox1.Color = clRed   ###does not work
		self.GroupBox1.SetProps(Parent=self, Color=clRed)  ###nor does this help
		self.GroupBox1.Font.Color = clWindowText
@Priyatham10 Priyatham10 added the enhancement New feature or request label Feb 12, 2022
@lmbelo lmbelo self-assigned this Feb 14, 2022
@lmbelo
Copy link
Member

lmbelo commented Feb 14, 2022

@aerilox we are working on a reproducible script. We will move more news soon.

@lmbelo
Copy link
Member

lmbelo commented Mar 25, 2022

@aerilox, please, try again after setting up the "ParentBackground" property of the GroupBox component to false before changing its color. See the exemple bellow:

self.GroupBox1.ParentBackground = False
self.GroupBox1.Color = clRed

@lmbelo
Copy link
Member

lmbelo commented May 15, 2022

@aerilox can I close this issue?

@aerilox
Copy link
Author

aerilox commented May 16, 2022

yes, thanks

@lmbelo lmbelo closed this as completed May 16, 2022
@shaunroselt
Copy link
Contributor

Setting Color property of self works ok. Setting Color property of components placed on self does not work. True for all components that have a Color property like Panel, GroupBox aso. Does not work at runtime either. Other properties can be assigned without problem.

	def __init__(self, Owner):
	### object Form
		self.SetBounds(310, 137, 730, 256) #self
		self.Caption = 'Form1'
		self.Color = clSkyBlue  ###colors all components on form, even if ParentColor is set False for each component
		self.Font.Color = clWindowText
		self.Font.Height = -11
		self.Font.Name = 'MS Sans Serif'
		self.Font.Style = []
		self.OldCreateOrder = False
		self.PixelsPerInch = 96
		self.TextHeight = 13
	### object GroupBox1, parent self
		self.GroupBox1 = GroupBox(self)
		self.GroupBox1.Parent = self
		self.GroupBox1.SetBounds(20, 20, 266, 136) #GroupBox1
		self.GroupBox1.Caption = 'GroupBox1'
		self.GroupBox1.Color = clRed   ###does not work
		self.GroupBox1.SetProps(Parent=self, Color=clRed)  ###nor does this help
		self.GroupBox1.Font.Color = clWindowText

Just to add some extra info to this.

The GroupBox needs ParentBackground = False to show color, but the Panel needs StyleElements = "" to show color.

It's two different reasons why Color isn't show for these two components.

I created two StackOverflow questions/answers for this also in case any one else searches for this or needs help on it:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants