Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Change Component Background Colors Runtime
Thu, Nov 29 2018 2:18 PMPermanent Link

R&D team @ Environment Canada

I have a project with multiple forms.  I would like the user to be able to click a button that changes the background color of certain components at runtime.  I am able to change the TGrid background in the properties, but do not see an option for TMultiLineEdit, TEdit, TEditComboBox, etc.  

Basically I want a 'Day' (Black text on white background)  & 'Night' (White text on black background) mode.

Is this possible?

Thanks
Nathan
Sat, Dec 1 2018 2:26 AMPermanent Link

Bruno Larochelle

hi Nathan

you might want to have a peak at a post from Erick E about a year ago..

search 'button color' on the forum, or here it is :

https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&msg=13840&start=1&keywords=tbutton%20color&searchbody=True&forum=EWB_Announce&forum=EWB_General&forum=EWB_Components&forum=EWB_Server&forum=EWB_Demos&forum=EWB_Binaries&forum=EWB_Discussion&forum=EWB2_Preview&forum=EWB_Beta#13840

.. Bruno




R&D team @ Environment Canada wrote:

I have a project with multiple forms.  I would like the user to be able to click a button that changes the background color of certain components at runtime.  I am able to change the TGrid background in the properties, but do not see an option for TMultiLineEdit, TEdit, TEditComboBox, etc.  

Basically I want a 'Day' (Black text on white background)  & 'Night' (White text on black background) mode.

Is this possible?

Thanks
Nathan
Tue, Dec 4 2018 2:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Nathan,

<< I have a project with multiple forms.  I would like the user to be able to click a button that changes the background color of certain components at runtime.  I am able to change the TGrid background in the properties, but do not see an option for TMultiLineEdit, TEdit, TEditComboBox, etc. >>

If you want to change the attributes of control interfaces at runtime, please see this post:

https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=15127#15127

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Dec 7 2018 5:01 PMPermanent Link

R&D team @ Environment Canada

Thanks Tim!

Nathan
Fri, Dec 14 2018 12:11 PMPermanent Link

R&D team @ Environment Canada

Hi Tim

The  "TempState.RootElement.Background.Fill.Color := ..." works perfectly for TMultiLineEdit and TButtons.  However, when I tried to apply the same to a TEdit and TEditComboBox nothing changes.  It looks like the RootElement applies to the Base Element in the Interface Editor, but the background color for TEdit and TEditComboBox is located in the Edit Element.  Is there a way to apply RootElement to other elements as well or is there a different TInterfaceState property that I need to use?

Thanks
Nathan
Wed, Dec 19 2018 11:52 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Nathan,

<< The  "TempState.RootElement.Background.Fill.Color := ..." works perfectly for TMultiLineEdit and TButtons.  However, when I tried to apply the same to a TEdit and TEditComboBox nothing changes.  It looks like the RootElement applies to the Base Element in the Interface Editor, but the background color for TEdit and TEditComboBox is located in the Edit Element.  Is there a way to apply RootElement to other elements as well or is there a different TInterfaceState property that I need to use? >>

Each control interface may need to be specifically handled.  Many controls are composed in a way that the base element is simply a container, and there are other child elements that are the actual important elements that need to be dealt with in terms of backgrounds, etc.

You can find specific elements under the root by using something like this:

TempEditElement:=TempState.RootElement.Elements.FindByName('Edit');

However, the one good thing is that there *is* a consistency to the control interfaces.  For example, all of the edit controls (including editable combo boxes) use the same type of element structure with the same names, so you could generalize the code to simply look for the "Edit" element, and if it doesn't exist, then just assume that it isn't an edit(able) control.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Dec 20 2018 4:04 AMPermanent Link

Matthew Jones

R&D team @ Environment Canada wrote:

> I have a project with multiple forms.  I would like the user to be able to click a button that changes the background color of certain components at runtime.  I am able to change the TGrid background in the properties, but do not see an option for TMultiLineEdit, TEdit, TEditComboBox, etc.  
>
> Basically I want a 'Day' (Black text on white background)  & 'Night' (White text on black background) mode.
>
> Is this possible?

I know this might seem mad, but I'll throw it out there. I needed to have edits with different coloured backgrounds - red, yellow, blue etc. My solution was simple. The standard edit was given a transparent background. And then I put the edit on a simple panel with a fill of the colour I wanted. Job done...


--

Matthew Jones
Sat, Dec 22 2018 11:29 PMPermanent Link

Bruno Larochelle

madness/cleverness... pretty narrow line divides the two... Smile
(I will be trying this)

"Matthew Jones" wrote:

I know this might seem mad, but I'll throw it out there. I needed to have edits with different coloured backgrounds - red, yellow, blue etc. My solution was simple. The standard edit was given a transparent background. And then I put the edit on a simple panel with a fill of the colour I wanted. Job done...


--

Matthew Jones
Image