Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Icon property confusion
Tue, Jun 14 2016 8:38 AMPermanent Link

Matthew Jones

I am trying to make a "tab bar" based on the TToolbar component. It
seems fine, apart from the UpdateAutoWidth because I want the layout to
be "Caption [icon]" for each tab. The elements are therefore TopLeft,
consume right. That's fine, but the code to determine the width is just
not behaving at all. I tried to work out if the icon is assigned or not
by testing the FIcon property, but it seems not to be working at
run-time. Is the serialisation affecting this somehow?

Anyone got clues? I'm not entirely sure the FCaptionElement is always
actually fitting the text properly either.

procedure TIndexBarButton.UpdateAutoWidth;
var
  TempWidth: Integer;
begin
  BeginUpdate;
  try
     if FAutoWidth then
        begin
        TempWidth:=(Width-ClientWidth);
        if FCaptionElement.Visible then
           Inc(TempWidth,FCaptionElement.Width);
        if FIcon = '' then
//        if FFontIconElement.Content <> '' then
           Inc(TempWidth,FIconElement.Width);
        Constraints.Max.Width:=TempWidth;
        Constraints.Min.Width:=TempWidth;
        end
     else
        begin
        Constraints.Max.Width:=0;
        Constraints.Min.Width:=0;
        end;
  finally
     EndUpdate;
  end;
end;
Tue, Jun 14 2016 2:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I am trying to make a "tab bar" based on the TToolbar component. It seems fine, apart from the UpdateAutoWidth because I want the layout to be "Caption [icon]" for each tab. The elements are therefore TopLeft, consume right. That's fine, but the code to determine the width is just not behaving at all. I tried to work out if the icon is assigned or not by testing the FIcon property, but it seems not to be working at run-time. >>

Do you want the icon width to be variable ?  With the default TToolBarButton class, the icons are assumed to be a fixed size, determined by the icon definition in the icon library.

<< Is the serialisation affecting this somehow? >>

No.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jun 15 2016 4:11 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Do you want the icon width to be variable ?

No, I am happy with it constant. But even making it a constant doesn't
work for me.

I will experiment further at some point, and perhaps post the whole
thing for someone else to help with. Having tabs standalone is really
nice. (I chose the name "IndexTab" to show it is more like an index,
due to the "conflict" with the Page control which has its own Tab
controls.)
Thu, Jun 16 2016 10:56 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< No, I am happy with it constant. But even making it a constant doesn't work for me. >>

You don't need to make it a constant - the "constant" is the defined width for the icon in the icon library.

<< I will experiment further at some point, and perhaps post the whole thing for someone else to help with. Having tabs standalone is really nice. (I chose the name "IndexTab" to show it is more like an index, due to the "conflict" with the Page control which has its own Tab controls.) >>

Is there any particular reason that you don't just use the TPagePanel control ?

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jun 16 2016 11:58 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Is there any particular reason that you don't just use the TPagePanel
> control ?

I don't want the pages. Basically, I have a display of data in a grid,
and I need to switch data type. So tab1 might be apples, and tab2
oranges. Click on one and the database filter changes, but no need to
change the grid itself. I actually have 5 different types, and at the
moment am just re-parenting the grid, but for the latest form I figured
it better to do a proper component.
Fri, Jun 17 2016 5:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I don't want the pages. Basically, I have a display of data in a grid, and I need to switch data type. So tab1 might be apples, and tab2 oranges. Click on one and the database filter changes, but no need to change the grid itself. I actually have 5 different types, and at the moment am just re-parenting the grid, but for the latest form I  figured it better to do a proper component. >>

It definitely is better to do a proper component, but personally I would have use the TPagePanel as a starting point.  I'll see if I can work something up.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jun 20 2016 4:17 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> personally I would have use the TPagePanel as a starting point.

It's where I started, but the pages were getting in the way, and the
toolbar seemed to have exactly what I needed and nothing more.

More than happy to adopt yours though! 8-)

(It might be worth asking what people want after 2.05 is out, but you
probably already know...)
Image