ListBroswer colors

AmigaOS users can make feature requests in this forum.
Post Reply
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

ListBroswer colors

Post by mritter0 »

Is there not a way to set an individual cell text to a specified color? LBNCA_FGPen does the entire column the same color.

Imagine a spreadsheet: negative number in red, regular text black, profit in green. Spread all over the listbrowser.

LBNCA_SoftStyle does each cell individually. Do it like that.

And I don't want to use a LABEL, just LBNCA_Text.


If anything, the column color should/could be set in the ColumnInfo struct if you want the entire column a certain color.
Workbench Explorer - A better way to browse drawers
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: ListBroswer colors

Post by tonyw »

Maybe a ListBrowser is not the best choice of Object to display the cells of a spreadsheet?
cheers
tony
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

Re: ListBroswer colors

Post by mritter0 »

I am not using it as a spreadsheet. IMAGINE, visualize, a spreadsheet, to get what I am talking about.

Just change LBNCA_FGPen from column to cell, just like LBNCA_SoftStyle, and it is fixed. Put entire column color in ColumnInfo.

Or add LBNCA_FGPenCell and leave then rest the same.
Workbench Explorer - A better way to browse drawers
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: ListBroswer colors

Post by thomasrapp »

mritter0 wrote: LBNCA_FGPen does the entire column the same color.
If this is true, it's clearly a bug. LBNCA attributes should only apply to the cell identified by node and column.

I tried with a small example and at least in ClassAct 3.3 it works as expected: every LBNCA_Text is drawn in the corresponding LBNCA_FGPen. Cells without LBNCA_FGPen appear in black (pen 1).

http://thomas-rapp.homepage.t-online.de ... lbcolors.c
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: ListBroswer colors

Post by salass00 »

thomasrapp wrote: If this is true, it's clearly a bug. LBNCA attributes should only apply to the cell identified by node and column.
Looking at the source code it should already be doing exactly that and nothing else.
User avatar
tbreeden
Posts: 160
Joined: Sat Jun 18, 2011 12:57 am
Location: Charlottesville, VA, USA
Contact:

Re: ListBroswer colors

Post by tbreeden »

tonyw wrote:Maybe a ListBrowser is not the best choice of Object to display the cells of a spreadsheet?
But it is possible. I've subclassed ListBrowser to get a SpreadSheet gadget, and overall I think it may have
been easier (for a tyro) than writing the gadget from scratch.:)

The FG/BG colors do work fine per cell, but it is frustrating that there is no LBNCA_Font. However, since
you do have LBNCA_RenderHook which which on entry is all set up for drawing within the cell,
you can have fine control via Graphics functions of how it will look.

The biggest problem is that there is no selection support for less than a node in ListBrowser, so
you must handle selection and drag selection via tracking the mouse position and buttons.

But ListBrowser does give you clipping to the cell, column width via dragging, easy horiz and vert
props, separators, sorting via hook, etc.

FWIW

Tom
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

Re: ListBroswer colors

Post by mritter0 »

*Sigh* I got it to work the way I wanted. I had the LBNCA_FGPen in the wrong part of the loop so it made every item in the column the same color, hence my post.

But...the Autodocs wording is what made me post:
LBNCA_FGPen (int16)
LBNCA_BGPen (int16)
The pens to be used for rendering the text or integer in this
column. Requires that the LBFLG_CUSTOMPENS flag in LBNA_Flags
be specified otherwise the default system pens will be used.
I took it as the entire column is set with this tag since it says column, not cell. So I stopped for the night before trying anything else.
Workbench Explorer - A better way to browse drawers
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: ListBroswer colors

Post by thomasrapp »

You are setting attributes of a node. The node identifies a row of the list. Each node in the list has as many columns as the listbrowser has. By node and column you identify a cell.

With LBNCA (List Browser Node Column Attribute) you set the attribute for a column of the node, not of the entire listbrowser.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: ListBroswer colors

Post by salass00 »

To add to what thomasrapp wrote the SetLBColumnInfoAttrsA() function, which takes LBCIA_#? tags, is what is used to modify attributes for the column as a whole.

The SetListBrowserNodeAttrsA() function can only modify attributes for the node specified.
Post Reply