There are two functions:
TDIGetTabByFormHwnd
TDIGetFormHwndByTab
Printable View
The issue seems to be in the Segoe MDL2 Assets font with some upper characters.
Use the IconTopOffset parameter to center the font in the position that you want in that cases.
Anyway I updated the OCX to allow to draw the character lower.
For example:
IconChar is a variant that can accept the Unicode character itself like ChrW(&HE00B&), the String representation of the character number, like "&HE00B&" or the character number like &HE00B& (the long value).Code:Private Sub NewTab1_TDIFormsShowTabIcon(ByVal TabNumber As Long, ByVal FormCaption As String, ByVal FormhWnd As Long, IconPicture As Object, IconLeftOffset As Long, IconTopOffset As Long, IconWidth As Long, IconHeight As Long, UseIconFont As Boolean, IconFont As Object, IconChar As Variant, IconColor As Long, IconColorHovered As Long, IconColorSelected As Long, NoIcon As Boolean)
UseIconFont = True
IconChar = &H1F9E1
IconTopOffset = -7
End Sub
IconFont is the StdFont object, passed as Object to avoid issues with typelib dependency to stdole2.tlb.
You can change the font name, size, etc.
The themes store property names.
The names of the old properties are in the themes that are saved into the themes collection property (the custom themes only).
They (the custom themes that maybe someone made) can be also saved locally from the Themes property page for to be used in other projects.
That was what I thought you were worried about. Well, that is what should be backward compatible with the old names, the saved custom themes.
Also the saved properties with old names should be read properly in the ReadProperties procedure (I also added code for that).
About the properties themselves, yes, if someone used those property names in code, she/he will have to change their names in the code. I don't think that many did, but yes, may be some.
Thanks for adding the ability to show an MDL2 Asset font as the tab Icon instead of the form Icon in TDI Mode:
These procedure parameters are already quite numerous, but it would be great if we could add:Code:Private Sub NewTab1_TDIFormsShowTabIcon( _
ByVal TabNumber As Long, _
ByVal FormCaption As String, _
ByVal FormhWnd As Long, _
ByRef IconPicture As Object, _
ByRef IconLeftOffset As Long, _
ByRef IconTopOffset As Long, _
ByRef IconWidth As Long, _
ByRef IconHeight As Long, _
ByRef UseIconFont As Boolean, _
ByRef IconFont As Object, _
ByRef IconChar As Variant, _
ByRef IconColor As Long, _
ByRef IconColorHovered As Long, _
ByRef IconColorSelected As Long, _
ByRef NoIcon As Boolean)
UseIconFont = True
IconChar = &H1F9E1
IconTopOffset = -7
End Sub
ByRef useFormCaption As Boolean
ByRef sFormCaption As String
or maybe add a new sub like
So then we could replace the limitations of showing Unicode chars in the form Caption, and the sFormCaption could replace the tab caption with Unicode chars. Especially helpful if the form caption is translated to a different language at runtime.Code:Private Sub NewTab1_TDIFormsShowUnicodeCaption( etc. )
Cheers
In the TDIBeforeNewTab event you can change the tab Caption.
Not sure if it would be a good idea to allow to change the caption here in the TDIFormsShowTabIcon event too, since there is already a FormCaption parameter, read only, that comes with the original form caption, without "(2)", "(3)" at the end, so it is not always the tab caption and could not be used for changing it.
It depends on how you are going to identify the forms.
Based on its previous caption:
Code:Private Sub NewTab1_TDIBeforeNewTab(ByVal TabType As NewTabCtl.NTTDINewTabTypeConstants, ByVal TabNumber As Long, TabCaption As String, LoadControls As Boolean, Cancel As Boolean)
If TabCaption = "Form2" Then
TabCaption = "New caption " & ChrW(&H2665)
End If
End Sub
Thanks! Is there a way to update the caption of a tab after it has been loaded?
This will allow the user to change the language of the UI (English to Chinese, etc.) at runtime, and not have to restart the app.
Cheers
Excellent. Thank you Eduardo for all of your hard work on this control.
Have you tested it in TwinBasic?
Cheers
https://github.com/twinbasic/twinbasic/releases
maybe check there to download the latest version, new major update 12 hours ago...
Cheers
Hello, Wayne already imported it and it is available as a package (experimental).
Hi Eduardo, thank you for your efforts, it would be great if you could add the ribbon to the menu.
I'm using html for the ribbon as well as NewTab, but it's getting too complicated and inconsistent, it would be great if both were in NewTab.
This is a suggestion if you have time to work on it
Attachment 193921
Hello Mojtaba, have you seen this project?: [VB6/Win7+] Using the Windows UI Ribbon Framework
I saw it today, but it was complicated to add items
I've used html in some cases and even flash in places to create a menu, each of which has its own problems.
In .NET and C# languages, there are very good controls in the field of toolbars and menus But vb6 is weak in my opinion
This NewTab control solved many of my problems, especially the MDI menu strip feature
Just now, an idea hit me to make a ribbon with newtab
I will create a test project and put it here
Every time I upload a picture, its clarity is reduced and it turns into a very low quality JPG. But your picture is either in PNG format. Online upload is also very clear, I do not know why.
It is very convenient to switch automatically through key search.
The.net framework, TreeView control, one with only the title text. However, the text of each item may be duplicated, so the search can not be accurately located.Then I wrote a lot of code to loop through each item. It is also convenient to use a unique numeric ID or key to locate directly.
Post questions about the forum here.
Hi Eduardo, the new update has a problem in the form section
When you open the form as vbModal, the form does not open independently and opens in the same tab
The latest update on GitHub has this problem, previous versions did not have this problem
-------------------------------------------------------------------------------------------------------
And another problem that exists at the beginning of the movie is the closing of the main page tab.
When you close another tab and double-click, the main page is also closed and nothing remains.
https://youtu.be/Oaqm24JoiSg
Hello Mojtaba, OK, please test now.
This happens when we have two or more tabs and we move to the home tab and other tabs several times and close the tabs, it happens and the home tab is also closed.
Move between the home tab and form 2 a couple of times, then close form 2 and click again in the same place where you closed form 2, and the home tab will also close.
--------------------------------------------
In Windows 7, the close icon is not displayed due to the lack of the correct font. What font do you use for the icons?
This problem does not exist in Windows 8, 10, 11
Attachment 194004
OK, thanks. Please test now.
Thank you, Eduardo, these two problems have been solved :)
I have seen these problems before, but I wanted to express all the problems in one post
Only about the X tab closing icon in Windows 7 is not displayed correctly
Of course, I solved this problem by installing the SEGMDL2 font
Attachment 194004
Attachment 194006
OK, I see the issue. I'll study it later or tomorrow.
Updated. Please test now.
successful
In terms of size, X is different, it is smaller in Windows 7, but the display problem has been solved
Windows 7
Updated version of NewTab
Attachment 194010
Windows 10
Updated version of NewTab
Attachment 194011
But in the previous version, with the font installed in Windows 7 SEGMDL2, the X size is equal to the Windows 10 image..
Windows 7
Previous version of NewTab
By installing the font
Attachment 194006
Updated NewTab Windows7
Now it's good, X size has become bigger
This is when the font is not installed
Attachment 194021
Updated NewTab Windows7
If the font is installed in Windows 7
Attachment 194006
There is no problem in other versions of Windows 8,10,11
Eduardo, I found a solution to the problem
as I said, this problem in Windows 7 is due to the lack of the Segoe MDL2 Assets font.
Well, use another font called MS Mincho. It is installed by default on all systems from XP to 11.
I put the character font X in the picture
Attachment 194022
Hello. I checked in an old machine that I have with XP and the MS Mincho font is not installed.
That image that you posted is from Windows 7 or from Windows 10?
Because it is not only if the font is installed, but also if it supports that character. You are using Unicode 2715 that is very high. In older Windows versions, the font may exists but not including the upper characters.
How about the Marlett font? The Close button icon is mapped to the "r" character:
Attachment 194023
Available since Win95:
https://en.wikipedia.org/wiki/Marlett
Ohh, I already disconnected the XP machine...
I'll check it later. But that seems a good option, thanks jpbro.
An older version of SnagIt (V11 from 2014-ish).
Marlett on XP:
Attachment 194024