Mega Search
23.2 Million


Sign Up

Make a donation  
Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using

Is it possible to create a toolbar in Delphi with two small arrows for 
scrolling the buttons?

Pier

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 14-Jan-2015, at 4:33 AM EST
From: Pier Nardin
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Pier Nardin wrote:

> Tom
> 
> I tried your suggestions but the scroll buttons still have no effect. I am also using
> TSpeedButtons on the toolbar, not TToolbuttons, so the buttons do not have a Wrap property. Do
> you think the TToolbar or TSpeedButton anchors are significant?
> 
> Pier

Pier

Possibly anchors may affect the toolbar but I don't know. It is designed to arrange the buttons, so
maybe .... Anyway, testing with TSpeedButtons instead of TToolButtons works ok for me.
BTW, I do my test with XE7 with VCL for Win32.
Here's the relevant part of my .dfm for reference. 

  object PageScroller1: TPageScroller
    Left = 0
    Top = 0
    Width = 1351
    Height = 27
    Align = alTop
    Control = ToolBar1
    TabOrder = 7
    ExplicitWidth = 635
    object ToolBar1: TToolBar
      Left = 0
      Top = 0
      Width = 1450
      Height = 27
      Align = alNone
      ButtonHeight = 25
      ButtonWidth = 13
      Caption = 'ToolBar1'
      DrawingStyle = dsGradient
      Flat = False
      List = True
      ShowCaptions = True
      TabOrder = 0
      Transparent = False
      Wrapable = False
      object SpeedButton1: TSpeedButton
        Left = 0
        Top = 0
        Width = 75
        Height = 25
        Caption = '1'
      end
      object SpeedButton2: TSpeedButton
        Left = 75
        Top = 0
        Width = 75
        Height = 25
        Caption = '2'
      end
      object SpeedButton3: TSpeedButton
        Left = 150
        Top = 0
        Width = 75
        Height = 25
        Caption = '3'
      end
      object SpeedButton4: TSpeedButton
        Left = 225
        Top = 0
        Width = 75
        Height = 25
        Caption = '4'
      end
      object SpeedButton5: TSpeedButton
        Left = 300
        Top = 0
        Width = 75
        Height = 25
        Caption = '5'
      end
      object SpeedButton6: TSpeedButton
        Left = 375
        Top = 0
        Width = 75
        Height = 25
        Caption = '6'
      end
      object SpeedButton7: TSpeedButton
        Left = 450
        Top = 0
        Width = 75
        Height = 25
        Caption = '7'
      end
      object SpeedButton8: TSpeedButton
        Left = 525
        Top = 0
        Width = 75
        Height = 25
        Caption = '8'
      end
      object SpeedButton9: TSpeedButton
        Left = 600
        Top = 0
        Width = 75
        Height = 25
        Caption = '9'
      end
      object SpeedButton10: TSpeedButton
        Left = 675
        Top = 0
        Width = 75
        Height = 25
        Caption = '10'
      end
      object SpeedButton11: TSpeedButton
        Left = 750
        Top = 0
        Width = 75
        Height = 25
        Caption = '11'
      end
      object SpeedButton12: TSpeedButton
        Left = 825
        Top = 0
        Width = 75
        Height = 25
        Caption = '12'
      end
      object SpeedButton13: TSpeedButton
        Left = 900
        Top = 0
        Width = 75
        Height = 25
        Caption = '13'
      end
      object SpeedButton14: TSpeedButton
        Left = 975
        Top = 0
        Width = 75
        Height = 25
        Caption = '14'
      end
      object SpeedButton15: TSpeedButton
        Left = 1050
        Top = 0
        Width = 75
        Height = 25
        Caption = '15'
      end
      object SpeedButton16: TSpeedButton
        Left = 1125
        Top = 0
        Width = 75
        Height = 25
        Caption = '16'
      end
      object SpeedButton17: TSpeedButton
        Left = 1200
        Top = 0
        Width = 75
        Height = 25
        Caption = '17'
      end
      object SpeedButton18: TSpeedButton
        Left = 1275
        Top = 0
        Width = 75
        Height = 25
        Caption = '18'
      end
    end
  end

-- 
Tom Brunberg
firstname.lastname@welho.com

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Jan-2015, at 6:55 AM EST
From: Tom Brunberg
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Tom

I tried your suggestions but the scroll buttons still have no effect. I am 
also using TSpeedButtons on the toolbar, not TToolbuttons, so the buttons do 
not have a Wrap property. Do you think the TToolbar or TSpeedButton anchors 
are significant?

Pier

"Tom Brunberg"  wrote in message 
news:709527@forums.embarcadero.com...
> Pier Nardin wrote:
>
>> Peter
>>
>> You have to put the TToolbar on top of the TPageScroller otherwise you 
>> can't set the Control
>> property of the TPageScroller to the toolbar. In any case when I reduce 
>> the size of the toolbar
>> by making the main form smaller the arrows appear but I still can't 
>> scroll the toolbar. Can you
>> help?
>>
>> Pier
>>
>> "Peter Below"  wrote in message 
>> news:709373@forums.embarcadero.com...
>> > Pier Nardin wrote:
>> >
>> > > Is it possible to create a toolbar in Delphi with two small arrows
>> > > for scrolling the buttons?
>> >
>> > Put a TPageScroller on the TToolbar, that gives you the two arrow
>> > button if the content of the toolbar overflows the toolbar client area.
>> >
>> > --  Peter Below (TeamB)
>
> Pier,
> It seems the TToolBar.Align is set to alTop by default. As a consequence 
> the width property is set
> to the width of the TPageScroller and if that is aligned alTop, the width 
> of the TToolBar is the
> clientwidth of the form at designtime. It also seems to be set WrapAble 
> when the buttons don't fit
> anymore at designtime, and the Wrap property to true of the first button 
> that doesn't fit.
>
> I tried setting the TToolBar.Align to alNone, the wrapable property to 
> false and its width to the
> width required by all the buttons on it. I removed the Wrap setting of any 
> buttons. Now it seems to
> be scrollable with the arrows.
>
>
> -- 
> Tom Brunberg
> firstname.lastname@welho.com

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Jan-2015, at 5:16 AM EST
From: Pier Nardin
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Pier Nardin wrote:

> Peter
> 
> You have to put the TToolbar on top of the TPageScroller otherwise you can't set the Control
> property of the TPageScroller to the toolbar. In any case when I reduce the size of the toolbar
> by making the main form smaller the arrows appear but I still can't scroll the toolbar. Can you
> help?
> 
> Pier
> 
> "Peter Below"  wrote in message news:709373@forums.embarcadero.com...
> > Pier Nardin wrote:
> > 
> > > Is it possible to create a toolbar in Delphi with two small arrows
> > > for scrolling the buttons?
> > 
> > Put a TPageScroller on the TToolbar, that gives you the two arrow
> > button if the content of the toolbar overflows the toolbar client area.
> > 
> > --  Peter Below (TeamB)

Pier,
It seems the TToolBar.Align is set to alTop by default. As a consequence the width property is set
to the width of the TPageScroller and if that is aligned alTop, the width of the TToolBar is the
clientwidth of the form at designtime. It also seems to be set WrapAble when the buttons don't fit
anymore at designtime, and the Wrap property to true of the first button that doesn't fit.

I tried setting the TToolBar.Align to alNone, the wrapable property to false and its width to the
width required by all the buttons on it. I removed the Wrap setting of any buttons. Now it seems to
be scrollable with the arrows.


-- 
Tom Brunberg
firstname.lastname@welho.com

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Jan-2015, at 4:11 AM EST
From: Tom Brunberg
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Peter

You have to put the TToolbar on top of the TPageScroller otherwise you can't 
set the Control property of the TPageScroller to the toolbar. In any case 
when I reduce the size of the toolbar by making the main form smaller the 
arrows appear but I still can't scroll the toolbar. Can you help?

Pier

"Peter Below"  wrote in message 
news:709373@forums.embarcadero.com...
> Pier Nardin wrote:
>
>> Is it possible to create a toolbar in Delphi with two small arrows
>> for scrolling the buttons?
>
> Put a TPageScroller on the TToolbar, that gives you the two arrow
> button if the content of the toolbar overflows the toolbar client area.
>
> -- 
> Peter Below (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 15-Jan-2015, at 12:42 AM EST
From: Pier Nardin
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Pier Nardin wrote:

> Is it possible to create a toolbar in Delphi with two small arrows
> for scrolling the buttons?

Put a TPageScroller on the TToolbar, that gives you the two arrow
button if the content of the toolbar overflows the toolbar client area.

-- 
Peter Below (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 14-Jan-2015, at 9:49 AM EST
From: Peter Below
 
Re: Scrollable toolbar  
News Group: embarcadero.public.delphi.vcl.components.using
Pier

>Is it possible to create a toolbar in Delphi with two small arrows for
>scrolling the buttons?

Yes. If you're trying to avoid doing it yourself look on torry

Roy Lambert

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 14-Jan-2015, at 5:10 AM EST
From: Roy Lambert