norgepaul / TChromeTabs

Comprehensive Delphi implementation of Chrome's tab system
Other
215 stars 78 forks source link

initialize TChromeTab.data before add #65

Closed mkormout closed 6 years ago

mkormout commented 6 years ago

Is that possible? Thank you! :)

par4dise commented 6 years ago

Do you mean that you need an event firing before TChromeTabsList.Add is executed? (in ChromeTabsClasses.pas)

mkormout commented 6 years ago

No, I need to create TChromeTab and initialize its data property and other stuff before it's added to collection... I need to have all tabs in the collection fully initialized. Something like: TChromeTabsList.Add(atab: TChromeTab)

landrix commented 6 years ago

I don't understand. TChromeTab.data is for userdefined data. What should be initialized there before? On nil?

mkormout commented 6 years ago

Actual situation:

tab := tabs.Add; //events are fired here -> data property is nil
tab.data := SomeData;

What I need is this:

tab := TChromeTab.Create();
tab.data := SomeData;
tabs.add(tab);

Or this:

tab := tabs.Add(SomeData); //events are fired here, but after data property initialization
landrix commented 6 years ago

Which event is triggered on tabs.Add? Which you need with .Data?

mkormout commented 6 years ago

fe.: OnActiveTabChanged

landrix commented 6 years ago

try this:

Exclude ActivateNewTab from TChromeTabs.Options.Behavior

and

  ct := ChromeTabs.Tabs.Add;
  ct.Caption := ...;
  ct.Data := ...;
  ChromeTabs.ActiveTab := ct;
mkormout commented 6 years ago

ok thx :)