Recent

Author Topic: ATTabs  (Read 51324 times)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: ATTabs
« Reply #30 on: April 15, 2017, 11:18:05 am »
How can I transform the above TPageControl code to insert a TForm in a TTabSheet in the below ATTab code for a new tab?
How will I be able close the tab with the Form embedded?
How will I be able to prevent the same Form to be opened more than once?

I think embedding a form in this way is an abuse of TForm which was never designed to be so used.
It is far too over-engineered and resource-hungry to be a good choice, and there are many alternative containers that would suit
your purpose better, among them TFrame, TPanel, TGroupBox, TScrollBox etc.
However, if you insist on embedding a form, I think the following would do it.
Code: Pascal  [Select][+][-]
  1. function TForm1.AddedTabSheet(aPageControl: TPageControl; aNewForm: TForm;
  2.   anImageIndex: Integer; const aTabCaption: string): TTabSheet;
  3. var
  4.    ts: TTabSheet;
  5. begin
  6.   ts:=TTabSheet.Create(Self);
  7.   try
  8.     ts.PageControl:=aPageControl;
  9.     ts.ImageIndex:=anImageIndex;
  10.     ts.Caption:=aTabCaption;
  11.  
  12.     aNewForm.Parent:=ts;
  13.     aNewForm.Align:=alClient;
  14.     aNewForm.BorderStyle:=bsNone;
  15.     aNewForm.Show;
  16.  
  17.     aPageControl.ActivePage:=ts;
  18.   except
  19.     ts:=nil;
  20.   end;
  21.   Exit(ts);
  22. end;    
You then have problems controlling scrolling. You close the tab by freeing it, or hiding it. If you free it, you have to make sure the form is also freed, or at least that its Parent is set to nil (if you have created the form via Application.CreateForm it will be freed by the Application).
Altogether a poor solution to the task of fitting a component container into a tabsheet.
What is wrong with adding controls to the tabsheet directly, with no intervening form?
« Last Edit: April 15, 2017, 11:30:15 am by howardpc »

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #31 on: April 15, 2017, 12:06:30 pm »

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: ATTabs
« Reply #32 on: April 15, 2017, 05:43:33 pm »
I think embedding a form in this way is an abuse of TForm which was never designed to be so used.
It is far too over-engineered and resource-hungry to be a good choice, and there are many alternative containers that would suit your purpose better, among them TFrame, TPanel, TGroupBox, TScrollBox etc.
What is wrong with adding controls to the tabsheet directly, with no intervening form?

I agree with you, but we are limited to schedule and budget.
We should convert a 600+ unit old delphi 7 RAD DB SDI application to be TDI (tabbed similar to Firefox).
First, we changed TMenu to TTreeView and main form from SDI to TPageControl. I know it's still an SDI application, but the final user feels like it's a TDI application.
Then, manually, we are rewriting all units, forms and datamodules as similar and as fast as possible, changing as little code as we can.
It's a third party project with client's programmers being trained and co-working with us. Unfortunately, we are not free to make all decisions on development. The client's programmers will maintain the project afterwards.
If we could, we would rewrite everything from scratch using OOP, ORM and tests.
Now, we want to change from TPageControl to something visually more beautiful.

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #33 on: April 15, 2017, 10:14:32 pm »
Btw, if you use in big application, you may want features.
Welcome, for donates.
600 forms -is big one.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: ATTabs
« Reply #34 on: April 16, 2017, 03:44:03 am »
It is a medium size project done by a medium size team.
A big size project is an ERP, which take years to be done by a big size team.
You are right, I always suggest donations on corporate projects that need open source projects.
« Last Edit: April 16, 2017, 04:36:18 pm by valdir.marcos »

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
Re: ATTabs
« Reply #35 on: April 17, 2017, 03:53:58 pm »
Hi
.
how can i change direction  RTL(Right to Left) ATTabs ??
.
some language like farsi and arabic direction is RTL.
.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: ATTabs
« Reply #36 on: April 17, 2017, 04:30:08 pm »
Read somewhere TTabControl is for cases where you have same controls on each tab, was sticked to that ...
Thats right. "Same" = "SynEdit with same content"
Therefore you need to manage the content yourself. However if you do that you loose undo info. So not good.

TATTabs is similar to TTabControl in the context that you have same all controls on each tab?

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #37 on: April 17, 2017, 04:37:06 pm »
About RTL order:
control dont support it, sorry.
It is work for donations.

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
Re: ATTabs
« Reply #38 on: April 17, 2017, 06:48:55 pm »
 :'( :'( :'( :'( :'(

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #39 on: July 25, 2017, 10:24:47 am »
Update

This is long time wanted feature.
+ prop Images (ImageList)
+ each tab's Data has TabImageIndex

It can show icons from Imagelist. Icon, if shown, shift text to the right.
Picture example.

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #40 on: September 16, 2017, 12:36:02 pm »
Big update: added scroll arrows (option of course) to scroll tabs which don't fit to client rect. Only arrows are like ST3, but tabs do not stack like in ST3. I dont think making stacking of tabs is good here. I dont like how it works in ST3. Simple scrolling of client area is good.

Quote
2017.09.15
+ add: scrolling arrows, they work when tabs painted out of right side (when lot of tabs)
+ add: scrolling mark (red on top if lot of tabs)
+ add: prop TabShowScrollArrows (note: it uses TabIndentInit)
+ add: prop TabShowScrollMark
+ add: prop TabScrollMarkX, TabScrollMarkY
+ add: prop ColorScrollMark
+ add: prop TabAngleMaxTabs: slow TabAngle will be used only until not much tabs
* renamed prop to ColorDropMark
* renamed type to TATTabTriangle, with values


And new is scroll mark (option).
it is red (option) 20x4 pixel (option) line, it shows on top of ATTabs, if tabs are scrollable.
« Last Edit: September 16, 2017, 12:38:14 pm by Alextp »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: ATTabs
« Reply #41 on: September 16, 2017, 03:35:04 pm »
If you do not mind suggestions, I would like to see the control being able to place the tabs  on the left and right with text rotation and if possible scroll through the mouse scroll wheel too. As for the stacking and ST3 I have no idea what are you talking about. If by stacking you mean multiple rows then you should consider implementing it. As for ST3....
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #42 on: September 16, 2017, 04:24:32 pm »
ST3 = Sublime Text 3. It has stacking of tabs: press Ctrl+N 50 times, you ll see stack of tabs.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: ATTabs
« Reply #43 on: September 16, 2017, 05:08:05 pm »
ST3 = Sublime Text 3. It has stacking of tabs: press Ctrl+N 50 times, you ll see stack of tabs.
thank you. I'll check it out when I get some time.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: ATTabs
« Reply #44 on: September 17, 2017, 10:14:14 am »
Update

renamed lot of properties from TabNNNN to OptYYYYYY (with different YYYYYY). sorry, user of ATTabs. prev names were short and I forgot meanings of some props. So I made longer names.

 

TinyPortal © 2005-2018