[SOLVED] TECTabCtrl fonts, colors and other features. lazarus / 31-LCL ---------------------------------------------------------------------- Raul_ES · 2020-06-03 18:07 Hello friends, I have a ECtabctrl, a combobox and a Notebook, all linked in a way that whenever I add or remove or switch a tab the list of items in the combobox and the pages in the notebook are updated. Pages contain different kind of frames (Point of sale, store, invoices, customers...) and are generated at runtime. Employees have an user id.  Everything fine up to here. Now, I am struggling to do the following with no success: The active tab has to be always yellow with geen bold fonts. The rest of the tabs must have regular default colored fonts, and their tab color will depend on the user id. If no user id is available (employee hast opened a pos with out identifying himself) the tab color will be the default clForm. 1 = active tab (it is also called visible tab? I have some confusion here, TabIndex != VisibleTabIndex) 2 = inactive tabs, hidden notebook pages 3 = combobox with captions of the pages 4 = minimize, close, lock, etc buttons I'll post some code. ---------------------------------------------------------------------- Raul_ES · 2020-06-03 18:21 I guess that this will be achieved with the onChange event procedure: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TmainScreen.ECTabCtrl_sheetTabChange(Sender: TObject);vari: integer; begin(...)if ComboBox_sheets.Items.Count>0 thenbegin    ComboBox_sheets.ItemIndex:=ECTabCtrl_sheetTab.TabIndex;    Notebook.PageIndex:=ECTabCtrl_sheetTab.TabIndex;end(...)  Switching, adding and removing pages works fine. Here comes the problem. I have to iterate through all the tabs except the active one to change the font options back to regular and the tab color has to be taken from the list of items. The items have the structure "[USER_ID - USER_NAME] CAPTION", so I need to extract USER_ID and get its associated personal color from a database or configuration file. How do I chage the color/font options for the tabs? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // TabIndex, PageIndex = o-n// Tabs.Count, Pages.Count = 1-m if Notebook.Pages.Count>1 thenbeginfor i:= 0 to ECTabCtrl_sheetTab.Tabs.Count-1 do; // iterate through tabsbegin  if not (i=ECTabCtrl_sheetTab.TabIndex) then     begin        ECTabCtrl_sheetTab.Tabs.Items[i].FontOptions.FontStyles:=[];       ECTabCtrl_sheetTab.Tabs.Items[i].FontOptions.FontColor:= clDefault;     //if (ECTabCtrl_sheetTab.TabIndex mod 2) = 0 then       //    ECTa bCtrl_sheetTab.Tabs.Items[ECTabCtrl_sheetTab.TabIndex].Color:=clMoneyG reen;     end else     begin       ECTabCtrl_sheetTab.Tabs.Items[i].FontOptions.FontStyles:=[fsBold];     ECTabCtrl_sheetTab.Tabs.Items[i].FontOptions.FontColor:= clGreen;   end;end;end; Nothing works as expected. ---------------------------------------------------------------------- Blaazen · 2020-06-03 19:02 Yes, TabIndex doesn't have to match VisibleTabIndex. Let's say you have 3 tabs. Tab 0 is visible, Tab 1 is invisible (or folded) and Tab 2 is visible and selected (a.k.a. active) then: ECTC.VisibleTabIndex = 1 length(ECTC.VisibleTabs = 2 ECTC.TabIndex = 2 ECTC.Tabs.Count = 3 I am goiong to check your second post. ---------------------------------------------------------------------- Blaazen · 2020-06-03 19:49 Man, your code works, I just tested it. But you have to remove that semicolon right after the loop!  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i for i:= 0 to ECTabCtrl_sheetTab.Tabs.Count-1 do; // iterate through tabs ---------------------------------------------------------------------- Raul_ES · 2020-06-03 20:51 OMG   I've been more than a week trying to figure out what the hell was going on   thanks Blaazen ---------------------------------------------------------------------- Raul_ES · 2020-06-03 20:59 Quote from: Blaazen on June 03, 2020, 09:02:48 pmYes, TabIndex doesn't have to match VisibleTabIndex. Let's say you have 3 tabs. Tab 0 is visible, Tab 1 is invisible (or folded) and Tab 2 is visible and selected (a.k.a. active) then: ECTC.VisibleTabIndex = 1 length(ECTC.VisibleTabs = 2 ECTC.TabIndex = 2 ECTC.Tabs.Count = 3 Blaazen sorry, but I don't really understand the concept of "visibility". All unfolded/not invisible tabs aren't suposed to be "visible"? ---------------------------------------------------------------------- Blaazen · 2020-06-03 21:56 Yes. Visible are those which you can click directly. Folded or invisible (i.e. etíoVisible is not in Tab.Options) are not in VisibleTabs array. But if you have many tabs in row and you have to scroll to reach them, they are still meant visible. There's function IsTabVisible() with a misleading name because it checks also if tab is in a visble area of the component. ---------------------------------------------------------------------- Raul_ES · 2020-06-05 12:16 Thank you Blaazen, have a nice day