Listview in Firemonkey - Text or Background in different Colors

Hi!

I hope the Forum stays stable now so I'm able to ask my question ;)

In Firemonkey a Listview is filled like this:

Var XXX : TListViewItem;
Begin
  ListView.Items.Clear;
  ListView.BeginUpdate;

  XXX:= ListView.Items.Add;
  XXX.Text := 'I am GREEN';

  XXX:= ListView.Items.Add;
  XXX.Text := 'I am RED';

  ListView.EndUpdate;
end;


I am looking for a way to change the textcolor or the background-Color of a cell.
Are there any simple posibilities to do this WITHOUT Livebindings? (I don't like lifebindings and don't want to use that)

There are many examples which shows this for VCL, but unfortunately Firemonkey does not have the necessary events.

There is one Idea I thought about: The Listview has Objects like Footer, Header and Item in ItemAppearance. How do I add an additional objects like the Item? If this would work, I could make one for each Colour (there are only 5).


Thanks in advance for every hint!


Markus
0
Markus
8/27/2014 8:42:19 AM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

6 Replies
6952 Views

Similar Articles

[PageSpeed] 36
Get it on Google Play
Get it on Apple App Store

> {quote:title=Markus Effenberger wrote:}{quote}
> Hi!
> 
> I hope the Forum stays stable now so I'm able to ask my question ;)
> 
> In Firemonkey a Listview is filled like this:
> 
> Var XXX : TListViewItem;
> Begin
>   ListView.Items.Clear;
>   ListView.BeginUpdate;
> 
>   XXX:= ListView.Items.Add;
>   XXX.Text := 'I am GREEN';
> 
>   XXX:= ListView.Items.Add;
>   XXX.Text := 'I am RED';
> 
>   ListView.EndUpdate;
> end;
> 
> 
> I am looking for a way to change the textcolor or the background-Color of a cell.
> Are there any simple posibilities to do this WITHOUT Livebindings? (I don't like lifebindings and don't want to use that)
> 
> There are many examples which shows this for VCL, but unfortunately Firemonkey does not have the necessary events.
> 
> There is one Idea I thought about: The Listview has Objects like Footer, Header and Item in ItemAppearance. How do I add an additional objects like the Item? If this would work, I could make one for each Colour (there are only 5).
> 
> 
> Thanks in advance for every hint!
> 
> 
> Markus

{code}
  with Listview1.Items.Add do
    begin
      text := 'Red';
      Objects.TextObject.TextColor := TAlphaColors.Red;
    end;
  with Listview1.Items.Add do
    begin
      text := 'Green';
      Objects.TextObject.TextColor := TAlphaColors.Green;
    end;
{code}

--
Linden
"Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"
0
Linden
8/27/2014 9:50:21 AM
> {code}
>   with Listview1.Items.Add do
>     begin
>       text := 'Red';
>       Objects.TextObject.TextColor := TAlphaColors.Red;
>     end;
>   with Listview1.Items.Add do
>     begin
>       text := 'Green';
>       Objects.TextObject.TextColor := TAlphaColors.Green;
>     end;
> {code}

Your sollution is perfect for Textcolor. Thx! BTW: Do you also have any idea how to do this for the cell's backgroundcolor?

..
0
Markus
8/28/2014 9:07:10 AM
> {quote:title=Markus Effenberger wrote:}{quote}
> > {code}
> >   with Listview1.Items.Add do
> >     begin
> >       text := 'Red';
> >       Objects.TextObject.TextColor := TAlphaColors.Red;
> >     end;
> >   with Listview1.Items.Add do
> >     begin
> >       text := 'Green';
> >       Objects.TextObject.TextColor := TAlphaColors.Green;
> >     end;
> > {code}
> 
> Your sollution is perfect for Textcolor. Thx! BTW: Do you also have any idea how to do this for the cell's backgroundcolor?

Yet only helpful :( as to your follow up ... that's a lot harder.

I haven't looked BUT maybe you could have a look at overriding the ListViewItems Render function (although this only effects the text part - I think ) 
--
Linden
"Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"
0
Linden
8/28/2014 10:34:46 PM
Do you also have any (easy implementable) idea how to do this for the cell's backgroundcolor?

> Yet only helpful :( as to your follow up ... that's a lot harder.

better? ;)
0
Markus
8/29/2014 7:27:30 AM
I don't know if this has the answer but check out:

http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RadStudio_XE6/Object%20Pascal/Mobile%20Samples/User%20Interface/ListView/

SampleListViewMultiDetailAppearancePackage.dpk

Is a custom ItemAppearance which adds 3 detail fields to TListView. There is also another one there that ads and image and other different configurations. Maybe you can either access it in there too or add a TRectangle as a background.
0
Eli
8/30/2014 2:00:20 AM
> {code}
>   with Listview1.Items.Add do
>     begin
>       text := 'Red';
>       Objects.TextObject.TextColor := TAlphaColors.Red;
>     end;
>   with Listview1.Items.Add do
>     begin
>       text := 'Green';
>       Objects.TextObject.TextColor := TAlphaColors.Green;
>     end;
> {code}
> 
> --
> Linden
> "Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"

hi,I found "WordWrap" not work in this case.

 with Listview1.Items.Add do
     begin
       text := 'Red';
       Objects.TextObject.TextColor := TAlphaColors.Red;
       Objects.TextObject.Wordwrap := true;
     end;

but the item text not wrap.

Edited by: Nan Zhou on Nov 18, 2014 5:51 PM
0
Nan
11/19/2014 1:51:28 AM
Reply:

Similar Artilces:

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Firemonkey
I am so dammed frustrated with firemonkey and livebindings. The VCL + DB Controls were fast, consistent, and stable. This fmx framework is crap. It's slow on my i5 Macbook. I'd be embarrassed to put out an app like this. The help is lousy and apparently very few people are using it based on my failed Google searches. I can see why. Livebindings is cute when you have a few fields, but it a rats nest when you have a moderately complex form and have to wire up dozens of controls. There is no official support for nullable fields in livebindings which blows my mind....

Different Background colors for different Document Types
Is it possible to have different Background window colors for different types of documents?  ...So for instance, if I were editing a JS file, it might have a light green background, but if I were editing a VB file, it might have a light brown?  It would be very useful to have this with all the different documents I have to have open at the same time.   As far as I am aware they all use the "Text Editor" colours. So no.Richard That would be very disappointing.  A number of free editors offer this kind of functionality.  It's not exactly new.Forg...

FireMonkey Listbox different colour for different lines
Hi All, trying to get used to FireMonkey. We have a program which uses a listbox to load a file and we would like to show each line as a different colour - similar to syntax colouring in an editor. I know that you have to use styles to do this but when after clikcing on Edit Custom Style, I become lost and have no idea. Any help would be much appreciated. Currently using XE3 > {quote:title=Fergus Dixon wrote:}{quote} > Hi All, trying to get used to FireMonkey. We have a program which uses a listbox to load a file and we would like to show each line as a different colour - similar to s...

Grid View Footer background Color based on either RowStyle background Color or or AlternatingRowStyle background Color
Hi Friends, As of my requirement,I have a grid view .Now the background color of the Footer of Grid view ,will have to be dynamic,i mean it will depend upon Row Style background color and AlternatingRowStyle background Color i.e, if the row above footer have row style ,then footer will have alternative row style background color and if the row above footer have alternative row style ,then footer will have row style background color. How can it be done. Regards, Ritesh This VB code in your GridView RowDataBound event may work for you: If e.Row.RowType = DataControlRo...

displayed row in different color on the background with different status
I am using C# on a Web App..... I have created a DataGrid on the form and a DataSet containing a Table Object.  When the first colum of data contains a specific data value, I want to change the displayed row of that data to a different color on the background.  Can someone help me on this? Yes u can do that. Do the following the itemdata bound event of ur datagridprotected void dgSample_ItemDataBound(object sender, DataGridItemEventArgs e) {if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {if (e.Item.Cells[0].Tex...

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

Background Color - sub menus
foo            bar          xyz    foo1         bar1          xyz1    foo2         bar2          xyz2 Background white in all, text font color black.  When I hover over foo1/2/... I want the background color to change to green and the text to change to white. When I hover over bar1/2/... I want th...

FireMonkey (location) background app
Hi All, I'm trying to get a FireMonkey application to keep on running in the background. This application is supposed to keep track of locations, so it's a "location" app. As far as I know, a number of application types can keep on running in the background, like "audio", "voip" or "location" apps, see also http://stackoverflow.com/questions/7291825/how-to-run-a-30sec-process-in-the-background-every-hour-iphone-app I've also found that I need to put a UIKit key in the .info.plist file (so perhaps I can be helped if someone ...

Delphi XE2, OSX and FireMonkey?
1. Does anyone know if developing with FireMonkey will be the only way to develop for OSX with XE2? 2. Does anyone know if you will need to compile on a Mac for OSX, or will XE2 cross compile? I know this will all come out during the world tour, but I'm just trying to get some idea so I can start planning. 1. Yes, I think for now it will be the only way. But you can probably build a native UI for OSX by directly using the API, like you can also develop Win32 applications without using the VCL. 2. XE2 will only be available for Windows, but it will compile for other platforms. &l...

ListView rows with different color
Using a listview in report style (with PFC), is it possible to have rows with different color?. For instance, red color for those that the corresponding row in the datastore has been modified. Thanks Nope. A datawindow can give you this functionality, though... -- pbm_hopethishelps, Roy Kiesler [TeamSybase] MySybase - http://my.sybase.com "H. Rivera" <~NO~SPAM~my.inbox@hotbot.com> wrote in message news:sCutriLJAHA.251@forums.sybase.com... > Using a listview in report style (with PFC), is it possible to have rows > with different color?. For instance...

textboxes have different background colors?
i have a bunch of asp:textboxes on a registration form.  however, when i run it the textboxes show up with different background colors.  some are orange-ish, some are yellow and some are green.  it doesn't show up like that in vs.net 2005.  it only shows up when i run it and view it in IE6.  it shows up alright in firefox.  also, it seems that some of my <td> alignment doesn't take in IE6, but again, it shows up as expected in firefox.  has anyone had these problems or maybe someone knows why this is happening? sounds like something is wrong...

ListView and RichEdit components for FireMonkey
The FireMonkey is a very interesting and promising cross-platform framework for Delphi. But it still lacks some basic components that always were in VCL, such as the ListView and RichEdit components. So the question: whether Em-ro has plans to design these components for the FireMonkey framework? Or may be some third party component vendors already work to bring the ListView and RichEdit to the FireMonkey. TMS, DevExpress, Sergey Tkachenko? Sergey Tkachenko wrote that they plan to start porting the TRichView to FireMonkey later in this year. http://www.trichview.com/forums/viewtopic.php...

firemonkey android
is it possible to do something in background when the application has not been opened? like a service.(for notification or somethings similar) > {quote:title=Fabio Giovanetti wrote:}{quote} > is it possible to do something in background when the application has not been opened? like a service.(for notification or somethings similar) when the user hits the home button, the app is just hidden from view....its still running and not hibernated (like on iOS) also there is a video/info about app notifications I saw somewhere...try the doc wiki or googling it > {quote:title=Brian Ha...

Web resources about - Listview in Firemonkey - Text or Background in different Colors - embarcadero.delphi.firemonkey

Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 12/20/2015 3:33:16 PM