Recent

Author Topic: [Solved] Problem in ATTabs: cannot make prop Tabs:TStrings  (Read 2802 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
[Solved] Problem in ATTabs: cannot make prop Tabs:TStrings
« on: October 01, 2017, 06:58:36 pm »
Pls see code in https://github.com/alexey-t/attabs
I try to make prop Tabs: TStrings for IDE.

- in IDE prop shows, I can change it, tabs appear
- on app start (with n tabs), tabs don't appear- ??
- after restart of IDE, in IDE tabs don't appear- ??

what am I doin wrong?
« Last Edit: October 03, 2017, 02:46:49 pm by Alextp »

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Problem in ATTabs: cannot make prop Tabs:TStrings
« Reply #1 on: October 01, 2017, 08:19:56 pm »
Don't assign the new strings to FTabItems, because you clear FTabItems immediately afterwards. The items are added individually anyway:

Code: Pascal  [Select][+][-]
  1. procedure TATTabs.SetItems(AValue: TStrings);
  2. var
  3.   i: integer;
  4. begin
  5.   //FTabItems.Assign(AValue);
  6.   Clear;
  7.   for i:= 0 to AValue.Count-1 do
  8.     AddTab(-1, AValue[i]);
  9. end;

BTW, your package does not compile on my Laz trunk/fpc 3.0.2. Move unit Windows to the top of the uses list in ATTabs.

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: Problem in ATTabs: cannot make prop Tabs:TStrings
« Reply #2 on: October 01, 2017, 08:32:35 pm »
Sorry, "Clear" is clearing of FTabList - not of FTabItems. FTabItems are not cleared.

fixed for "windows" unit.
« Last Edit: October 01, 2017, 10:05:02 pm by Alextp »

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem in ATTabs: cannot make prop Tabs:TStrings
« Reply #3 on: October 01, 2017, 10:27:04 pm »
I don't see that you override Loaded. You need to override it, call the inherited version, then build your tabs from FTabItems which would have the items ready for you.

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: Problem in ATTabs: cannot make prop Tabs:TStrings
« Reply #4 on: October 02, 2017, 12:03:07 am »
Thanks - this is the solution! fixed.

 

TinyPortal © 2005-2018