In TDI Mode how do I get the hWnd (or anything else) of the underlying form of the tab
Printable View
In TDI Mode how do I get the hWnd (or anything else) of the underlying form of the tab
Hello, I added a TDIGetFormHwndByTab function.
Please update to the new version.
Hello Eduardo!
I've been using the "NewTab" control you developed lately, it's very powerful, thank you for your efforts.
Now there are some questions I would like to ask you how to solve:
1. How to set the "NewTab" control property, in order to imagine the "SSTabEx" control, in the design mode, you can directly draw the required Lable, TextBox, ComboBox and other controls directly into different tabs, so as to facilitate the adjustment of the typography or set the properties of the controls in each tab, (instead of using "Move the controls to another tab" or "Move a control to this tab.") "Method);
2. Can I add the property "Public Property TabKey(ByVal Index As Integer) As String" or "Public Property TabName(ByVal Index As Integer) As String". Tabs that are used to distinguish between different (unique names). "Index" or "TabCaption" cannot completely distinguish unique tabs, and "order" cannot be changed synchronously with the "TabCaption" value after the order is changed. In addition, you can set the value corresponding to "TabKey" or "TabName" in the property page. (Application scenario: When the software title is displayed in multiple Chinese languages, you need to assign different language characters to the "TabCaption attribute" according to the unique value "TabKey" value)
3. If you can't add the "TabName" or "TabKey" attribute. Is it possible to add the "TabTag" and attributes to the "Property Page" so that the "Key" or "Name" value can be manually filled in to the "TabTag" at design time.
4. In "TDI" mode, after the form is loaded, if you reset the value of "Caption" of the form, the form will be "detached" from the tab and will become a non-"TDI" form. (Application scenario: When the software title is displayed in multiple Chinese languages, the form title will be reset)
Please help, thank you very much!
Attachment 191246
Attachment 191247
Update released.
2024-04-22 Improved in TDI mode forms when the form's caption is changed.
2024-04-22 Added TDIGetTabByFormHwnd function.
Hello, thanks.
I guess you must be using the control in source code, and I understand that you are asking how to change the current tab at design time (clicking the tab is disabled by default when running in source code as a protection for the subclassing).
To turn the protection off, comment the first line: "#Const NOSUBCLASSINIDE = 1" or change the 1 by a 0.
Or, change the current tab with the TabSel property from the property window.
The TabTag property already exists. Its type is String.
There is also another multipurpose property, it is TabData. Its type is Long.
You can use any of these properties for storing custom data.
Also there is a FindTab method that can be used to locate a tab by its TabTag or TabData values.
Fixed in the last update. Thanks for reporting.
(Please test)
I also added a TDIGetTabByFormHwnd method that is a companion for the TDIGetFormHwndByTab recently added.
Hello Eduardo!
1. I did use the controls in the source code. Following the method you instructed, after switching to an OCX file, you can already add controls on the various tabs.
2. Reset the "Title" value of the form, and the form will be "detached" from the tab. After replacing the latest version of the file, the test results are used normally and the form is no longer "out of the box".
3. Can the functions of TabTag, TabData, and TabKey be realized as shown in the red box in the screenshot below?
Thank you very much!
Attachment 191275
Hello. There is currently no 'TabKey' property.
About being able to set the TabTag and TabData properties at design time, I'm working in rearranging the property pages. Not sure it I'll have that finished today.
Hello Eduardo!
Thank you for your prompt response, and for the help you have given me!
1. The "TabStrip" control has a "Key" attribute. It would be nice if you could implement the "TabKey" property in "NewTab", and it doesn't matter if you can't.
2. "TabTag, TabData" can also basically replace the function of "TabKey" if it can be placed in the property page.
Attachment 191301
Thank you very much!
Update released.
Code:2024-04-24 Changed to OLE version 9.0.
2024-04-24 Added property TabKey. That key can be used to set the current/active/selected tab with the Tab property now.
2024-04-24 Added function GetTabOriginalIndex.
2024-04-24 Now TabTag, TabData, TabFixedWidth and TabCustomColor properties can be set at design time.
2024-04-24 Tabs property page split into two property pages (Icons went to a new property page).
2024-04-24 Fixed bug in TabCustomColor property.
Note that now it is possible to select a tab in code by its TabKey, like:
Code:NewTab1.Tab = "Config"
Opinion(s) wanted:
Keys case sensitive or insensitive? In the current version they are case sensitive.
IMO case insensitive keys would be preferable (and likely to result in fewer questions/false bug reports for you). Somebody is going to accidentally type NewTab1.Tab = "config" and wonder why the tab isn't being selected.
Update released.
2024-04-25 TabKeys are now case insensitive.
Hello Eduardo!
Thank you for your quick response, and for helping me!
1. The new version is tested normally and has been used in my project, which solves the problem in the project and helps me a lot. Thank you very much!
2. Regarding the value of "TabKey", my personal suggestion is that it should have "uniqueness (there should be no duplicate values)"
3. For example, the "Key" value in the "ToolBar or TabStrip" property page can not be filled, if filled, the filled "Key" value is not allowed to be repeated, as shown in the screenshot below.
Thank you very much!
Attachment 191329
Attachment 191330
Yes, thanks for your testing!
Update released. Keys now must be unique.
Hi, a possible bug:
I've added some labelplus controls inside a tab and the mousemove/mouseover events does not work in that labels (same code works ok if I put the controls outside the tab).
NewTab is changing the colors of all the labels I place on the tab to the ForeColorTabSel color. Notice in the screenshot that the labels are blue but should be vbButtonText. I can change it to vbButtonText in the designer but when I run the code it's changed to blue again.
Attachment 191797
I'm seeing this only with label controls (which happen to be Krool's VBCCR labels, if that matters)
I'm doing more tests because sometimes works, really don't know why. The problem could be in the LabelPlus side but I have more (custom controls) with same behaviour under NewTab. Only problems with the MouseMove/MouseOver events, all other things works fine. But may be my program, let me do more tests, I'll keep you in touch.
Check the ScaleMode of the Form (just a hunch).
If non-Twins scalemodes cause problems, it must be an issue of those controls.
Take into account this: NewTab does not have ScaleMode, it works always in twips no matter the ScaleMode of the form. The same as the SSTab control, and other control containers (other than the PictureBox).
Ocx project can first check (remote server file) to generate TLB, then set it to binary compatibility and select the generated OCX file.
If you don't want to bring OCX files to others, you can refer to TLB instead. After the OCX is generated by the client computer, you can select binary compatibility to refer to the OCX.
---------------------------
Activation control' VB.UserControl' failed. This control may not be compatible with your application. Make sure that the version of the control you are using is provided by your application.
---------------------------
If the control is edited again, the project that references the control will be useless. What should I do?
why use NewTab01.cmp?
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SysWow64\stdole2.tlb#OLE Automation
Object={66E63055-5A66-4C79-9327-4BC077858695}#9.0#0; NewTab01.ocx
I CREATE NEW VB6 PROJECT ,ADD OCX,BUT GUID NOT SAME
Object={3D29F268-3323-498B-96B7-7EC86FDA6EA8}#4.0#0; NewTab01.ocx
YOU CAN USE ocx project for create TLB ,SO ALL project can use tlb,not ocx
it will create a tlb file for ocxCode:NewTabCtl.vbp
ServerSupportFiles=1
CompatibleEXE32="..\test compiled ocx\NewTab01.TLB"
ServerSupportFiles=1
An image on one of your forms takes up 1mb of space.
If we can make the source code the same as the package, we can add it to different projects by connecting it once, which will be more convenient.
Some spaces need to be initialized from submain. You can also add an interface intmain to it.
Added a MIT license to this and all my repositories on Github.
Hello, major update.
Most important changes are:
The complete Changelog here.Code:2024-12-29 Changed to OLE version 10.
2024-12-29 All properties with names including 'TabSel' have been changed to 'SelectedTab' for clarity and better naming. The TabSel property is retained (hidden) for backward compatibility.
This will break all of the previously created themes? If this is for only name clarity, it's not worth it.
Otherwise, the .ocx should automatically update all theme properties such as these, which is specified in my Form_Load, as we cannot rely on a .frx or the controls definition section in a .frm to store theme properties, so the user can change from light to dark mode during runtime.
Code:.BackColorTabSel
.FlatBarColorTabSel
.HighlightColorTabSel
.HighlightModeTabSel
What is the preferred method / property to show unicode chars in the tab TDI form caption?
Is there a way to substitute the tab icon (which is the form icon) with Segoe MDL2 assets font in a TDI?
I'd like to know if this is a bug or something on my end:
When I hide controls on a TDI form at app startup, and then during runtime set them to .visible, they still will not be drawn.
Cheers
In TDI mode, it would be helpful to have a ntFindTabFormhWnd in Enum NTFindTabMethodConstants.
Cheers
You can show Unicode chars in a form caption like this (code in the form):
Or you can change the caption in the TDIBeforeNewTab event.Code:Private Declare Function DefWindowProcW Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Friend Property Let CaptionW(nCaption As String)
Const WM_SETTEXT As Long = &HC
DefWindowProcW Me.hWnd, WM_SETTEXT, 0&, ByVal StrPtr(nCaption)
End Property
Friend Property Get CaptionW() As String
Const WM_GETTEXT = &HD
CaptionW = Space$(2048)
CaptionW = Left$(CaptionW, DefWindowProcW(hWnd, WM_GETTEXT, Len(CaptionW), StrPtr(CaptionW)))
End Property
Private Sub Form_Load()
CaptionW = "your Unicode Caption"
End Sub
You can do it in the TDIFormsShowTabIcon event:
But I see that there is an issue with the character position. I'll see to fix that and issue an update.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 = ChrW(&H2665)
End Sub