Tabbed document interface in Delphi
Asked Answered
I

5

5

I'm considering different user interface layouts for my next project and I was wondering if there are either integrated or 3rd party frameworks which allow me to create tabbed document interface?

To clarify, what I want is not some kind of docking mechanism or either an MDI interface but primarily a framework which allows me to have one main form and one or more secondary forms which will be shown as tabs inside the main form.

Though I said I don't want any kind of docking mechanism, I made a small test application that actually uses it. The result I got is very close to what I want. First, I miss some features like the close button on each tab. Second, I'd have to create some kind of framework of my own in order to automate all tasks, like creating and destroying the tabs, associating each new form with its tab, freeing the form when the associated tab is closed and so on. I'm not saying I can't do it but I'd like to know if there are any ready-made frameworks which already have all these features. Though I'd prefer an open source solution, a commercial one is also welcome.

Idaho answered 16/1, 2011 at 2:22 Comment(2)
The problem of tabbed interfaces goes far beyond adding tabs. That's the easy part. There are more complex ones, for example adding the merging of menus/toolbars/ribbons in a sensible way.Retiary
In my case, only main form will contain the Menu bar and there will be no merging with menus from other forms, since there will be no menus there. With toolbars it's different. It is normal to have additional toolbars in each form and, since those forms will be "integrated" inside the main form and connected to it's tab, those secondary toolbars will be "right at home" with functions related only to the forms they are placed in.Idaho
H
6

I don't think there is any framework for tabbed interface, but for nice looking tab/page controls with close buttons on each tab, please check the following:

  1. rkSmartTabs, it simulates Google Chrome browser's tabbed UI. and it's open source.
  2. TAdvOfficePager, MS Office style.

Hope it helps.

Hayman answered 16/1, 2011 at 6:3 Comment(4)
rkSmartTabs is a really good-looking component, and code is very clear!Tolyl
thanks for recommending both, they do look nice, but I have to check out the functionality I get. I'll post another comment when I do.Idaho
rkSmartTabs looks nice and seems like and good starting point. It has some design-time painting problems in D2010, property names are inconsistent and I had some problems installing it in the IDE since author did not provide any information on requirements, but I can live with all of that for now. I have yet to try TAdvOfficePager.Idaho
+1 for rkSmartTabs - lovely component, it's amazing that it's free!Logarithm
T
7

Third-party components are not mandatory here.

You can use standard Delphi controls to obtain what you want:

  • Put a TPageControl on your form (from Win32 tab);
  • Set its Align property to alClient;
  • Right click on the control, then select "New page" to add a new page.

Then don't write your "tabbed" interface on forms, but on frames.

You can also create pages by code, displaying the frame inside each page.

Tolyl answered 16/1, 2011 at 8:20 Comment(5)
Do you have any experience with using Frames from DLLs? My application is modular where each module is in different DLL. Correct me if I'm wrong but I think that Frames can only work from BPLs.Idaho
@LightBulb: a BPL is a DLL, and the preferred way to divide up monolithic applications.Delaryd
You don't need frames to stick with the rest of A.Bouchez'suggestion. Use whatever wincontrol you like as the generic parent in your DLL and put it onto the TPageControl using setParent.Aught
One serious problem that I found when embedding forms inside another form, especially if they are coming from DLL is that I lose shortcuts (for example in TActionList) and there seems to be some focusing issues (TAB is not moving focus to next control in order). So far I haven't found solution to these problems. I'm hoping that the docking method I tried will not lead to same problems.Idaho
@LightBulb: Why should frames only work from BPL? I don't see any reason for that, since they are some kind of DLL. About TActionList problem, you'll have to use only one instance of it, and IMHO it will work as expected. @Paul-Jan: Of course, the question was about embedding some components in a form, not only one. That's why I proposed the frame approach.Tolyl
H
6

I don't think there is any framework for tabbed interface, but for nice looking tab/page controls with close buttons on each tab, please check the following:

  1. rkSmartTabs, it simulates Google Chrome browser's tabbed UI. and it's open source.
  2. TAdvOfficePager, MS Office style.

Hope it helps.

Hayman answered 16/1, 2011 at 6:3 Comment(4)
rkSmartTabs is a really good-looking component, and code is very clear!Tolyl
thanks for recommending both, they do look nice, but I have to check out the functionality I get. I'll post another comment when I do.Idaho
rkSmartTabs looks nice and seems like and good starting point. It has some design-time painting problems in D2010, property names are inconsistent and I had some problems installing it in the IDE since author did not provide any information on requirements, but I can live with all of that for now. I have yet to try TAdvOfficePager.Idaho
+1 for rkSmartTabs - lovely component, it's amazing that it's free!Logarithm
B
1

I recommend using a tool bar(TToolBar or any similar) and frames(TFrame) in order to mimic tabbed interface, reason?! well Delphi is going cross platform(no secret in that) they will port most if not all of the standard VCL shipped with Delphi, so WHY NOT use this as an advantage?

Just create the frame(dynamically) when the user clicks on a button from tool bar and destroy the previous one(if exists) so you will keep memory usage at minimum, application startup/shutdown time will be very good, on the other hand, if you chose to use (cx)TPageControl, TAdvPager, etc. you might get caught in a situation in which one form(the main I suspect) will have so many VCL's that it will take a lot of UNNECESSARY memory and it will be slow.

Using frames has a lot of advantages, if somewhere in your application you need a "tab" to be shown, you can simply create the needed frame dynamically and use it without additional work.

Anyways, this is my two cents, hope this helps.

Boykins answered 16/1, 2011 at 13:3 Comment(5)
I need a dynamic UI, which means I will be creating and destroying forms/frames on user actions. Tabbed UI seems like a good layout. Using TToolBar is one way to do it, but using a simple TTabSet and docking newly created forms/frames inside the client area of the main form sounds simple enough for me since I can create the whole framework. Point was if I could find something that already exists.Idaho
@Idaho ohhh, OK, I'm not aware of any components near to your needs, however I strongly suggest keeping the project as far away as you can from third party components which you can live without, especially if your the team leader or company owner, as the project grows you will understand what I mean.Boykins
I understand very well what you're saying. I am a team leader in my company and I have to decide which approach will we used for the next version of our software. I'd very much like to stick to integrated solutions or using open source components which are actively developed. Using 3rd party components is not so bad if you know exactly what you need and how to properly use them. I usually end up making my own components or frameworks, but being able to use something that already exists means saving resources.Idaho
When Delphi goes cross-platform, AFAIK it won't use the VCL. It will use something alike the old CLX. And if you used CLX, you would know you couldn't get a VCL application and turn it into a CLX one easily.Retiary
@ldsandon I haven't used CLX to be honest, but I'm pretty confident that they will provide at least a "Import VCL application" option... at least that's one of my many expectations :)Boykins
C
0

I recommend TvjPageList, which is part of the JVCL suite of components. It's open source and seems to fit your requirements.

Catherinacatherine answered 16/1, 2011 at 6:2 Comment(2)
I don't see any tabs in this component. It looks to me that it behaves similar to TNotebook.Idaho
@LightBulb: if it is similar to a TNoteBook, it just means that you put your frames/forms in the client area of the main form below the TNotebook look-a-like. It also means that you do not need to manage the creation/destruction of the TTabControls on which you would otherwise put your frames/forms, because that is what is required by a TPageControl.Satori
D
0

I use JVCL JvDocking, and its tabbed docking system, to make MDI-like applications.

You can also float, or tile your windows, in addition to having them in tabs.

Dispense answered 17/6, 2011 at 0:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.