diff --git a/lcl/interfaces/win32/win32wsextctrls.pp b/lcl/interfaces/win32/win32wsextctrls.pp index 5408237d6a..6725a13f91 100644 --- a/lcl/interfaces/win32/win32wsextctrls.pp +++ b/lcl/interfaces/win32/win32wsextctrls.pp @@ -424,28 +424,31 @@ var begin with ANotebook do begin - TCI.Mask := TCIF_TEXT or TCIF_PARAM or TCIF_IMAGE; - // store object as extra, so we can verify we got the right page later - TCI.lParam := PtrUInt(AChild); - TCI.iImage := ANotebook.GetImageIndex(AIndex); -{$ifdef WindowsUnicodeSupport} - if UnicodeEnabledOS then + if ShowTabs then begin - TCI.pszText := PChar(PWideChar(Utf8Decode(AChild.Caption))); - Windows.SendMessage(Handle, TCM_INSERTITEMW, AIndex, LPARAM(@TCI)); - end - else - begin - TCI.pszText := PChar(Utf8ToAnsi(AChild.Caption)); + TCI.Mask := TCIF_TEXT or TCIF_PARAM or TCIF_IMAGE; + // store object as extra, so we can verify we got the right page later + TCI.lParam := PtrUInt(AChild); + TCI.iImage := ANotebook.GetImageIndex(AIndex); + {$ifdef WindowsUnicodeSupport} + if UnicodeEnabledOS then + begin + TCI.pszText := PChar(PWideChar(Utf8Decode(AChild.Caption))); + Windows.SendMessage(Handle, TCM_INSERTITEMW, AIndex, LPARAM(@TCI)); + end + else + begin + TCI.pszText := PChar(Utf8ToAnsi(AChild.Caption)); + Windows.SendMessage(Handle, TCM_INSERTITEM, AIndex, LPARAM(@TCI)); + end; + {$else} + TCI.pszText := PChar(AChild.Caption); Windows.SendMessage(Handle, TCM_INSERTITEM, AIndex, LPARAM(@TCI)); + {$endif} + // clientrect possible changed, adding first tab, or deleting last + // windows should send a WM_SIZE message because of this, but it doesn't + // send it ourselves end; -{$else} - TCI.pszText := PChar(AChild.Caption); - Windows.SendMessage(Handle, TCM_INSERTITEM, AIndex, LPARAM(@TCI)); -{$endif} - // clientrect possible changed, adding first tab, or deleting last - // windows should send a WM_SIZE message because of this, but it doesn't - // send it ourselves LCLControlSizeNeedsUpdate(ANotebook, true); end; end;