6

I'm looking for a way of implementing a sort of inset caption before a set of tabs, something like this:

enter image description here

The tab set is not supposed to be multi-line, will only be horizontal and laid out at the top. However it should be correctly scrollable when there are too many tabs.

I fear I'm going to be restricted here with regard to using third-party controls, but I could use subclassing on the standard TTabControl to add the necessary changes to the standard looks and behaviour. (I don't need it to be TPageControl, because it's only the specific arrangement of the tabs that I am interested in.)

Maybe there's some way of implementing this with craftily arranged combination of standard controls, which, despite my endevours, has escaped me.

Basically, any ideas or pointers are welcome.

Oh, and additional requirement is, it should blend well with desktop themes.

Andriy M
  • 76,112
  • 17
  • 94
  • 154

3 Answers3

1

Granted some time has passed, but I recently needed this style and found you can do it with the TMS Software TAdvOfficePager. It has a property FixedTabs, which I set to 1 in this case. It also has an OnChanging event where you can prevent access to a tab, in this case I used AllowChange := (ToPage > 0); Lastly, I set the first tab to disabled.

Then just style the first tab different than the rest and you can have something like this:

enter image description here

Tony
  • 818
  • 1
  • 7
  • 21
  • This seems to be ticking all the boxes. Except it's a third-party component, and a paid one too. Which is perfectly fair as far as I'm concerned, because, given the number of features listed at the [component's page](http://www.tmssoftware.com/site/aop.asp#features), they must have put a lot of effort. It's just that I doubt my company will agree to pay so much. Anyway, thanks for finding and sharing this. – Andriy M Jan 16 '18 at 14:30
0

Here is crafty arrangement of controls that will work. I have done this sort of thing in the past. Best of all it automatically handles scrolling of tabs.

Crafty arrangement

JohnS
  • 1,942
  • 1
  • 13
  • 16
  • Not downvoting your answer, but have you tested this to make sure it will "blend well with desktop themes"? It would have been better to annotate a copy of the runtime image of the form, rather than design-time that doesn't demonstrate the actual appearance or how it "blends" with runtime themes. – Ken White Oct 17 '14 at 03:05
  • @Ken-White, Mea culpa. This was knocked up in Delphi 5 (no themes). I should have done a run-time screengrab. That said, this uses standard VCL stuff which, as I've said, have used this sort of arrangement in the past without issues. I suppose I was focusing on the problem of tab scrolling for this answer. – JohnS Oct 17 '14 at 04:14
  • Thank you for the suggestion. I considered [a similar approach, only with a panel](http://imgur.com/0npMzVT) instead of a page control (I didn't need multiple pages, only tabs). The issue was same as with your arrangement: the upper border of the panel was always visible, which was unacceptable because I really wanted the seamless looks of a TTabControl with a caption before the tabs. – Andriy M Oct 17 '14 at 05:26
0

Have you tried to make the first tab to be the caption you want. With some additional logic you can restrict the selection of this tab.

I don't know if you can control the style of each tab individually to make the first one look as it is not the tab.

Drejc
  • 14,196
  • 16
  • 71
  • 106
  • Thanks, I was thinking about that, actually. Sustaining a specific look and behaviour for a certain tab *could* be somewhat problematic indeed. But a much bigger problem would be to implement it together with the correct scrolling of tabs. – Andriy M Apr 07 '11 at 12:39