Re: CommonControls (Replacement of the MS common controls)
Originally Posted by TomasEss
Hi
My project has used VBCCR11.OCX successfully :-) for a long time. Now I thought I would upgrade to 17.
My DTPicker controls now no longer have the ShowCalendar method. Is this intentional? I have not found anything about it in this thread.
Am I supposed to be able to programmatically show it some other way?
It must be replaced by the .DroppedDown property (get/let).
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by samer22
please could you tell why labelws and CommandButtonWs are showing Arabic language like this:
I cant reproduce this problem here using Window 7 with VBCCR1.7:
All controls use the standard font "MS Sans Serif".
MAybe your problem has something to do with your windows unicode settings for non-unicode programs.
From my experience i can tell you that this windows setting can screw up the unicode display of vb apps.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Semke
how does the CommandButtonW.ImageList work with Picture DisabledPicture and DownPicture?
do i need a separate ImageList for each CommandButtonW/Picture-type
also i noticed that the MaskColor/UseMaskColor don't work when using picture without ImageList
MaskColor is only applicable for Style = 1 Graphical.
Same with DownPicture and DisabledPicture.
For Style = 0 Normal you can either use Picture or ImageList.
Code:
' The image list should contain either a single image to be used for all states or
' individual images for each state. The following states are defined as following:
' PBS_NORMAL = 1
' PBS_HOT = 2
' PBS_PRESSED = 3
' PBS_DISABLED = 4
' PBS_DEFAULTED = 5
' PBS_STYLUSHOT = 6
Re: CommonControls (Replacement of the MS common controls)
Hello,
I'm using the VBCCR16.OCX and I want to upgrade to VBCCR17.OCX but the VisualStyles.bas of the VBCCR17 doesn't include the SetupVisualStyles function or the InitVisualStyles.
With the VBCCR16, I had on the top of each form "SetupVisualStyles(me)", isn't this necessary anymore?
Thanks
Last edited by PauloFranc; Jan 24th, 2022 at 07:32 AM.
Reason: Typo
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by PauloFranc
Hello,
I'm using the VBCCR16.OCX and I want to upgrade to VBCCR17.OCX but the VisualStyles.bas of the VBCCR17 doesn't include the SetupVisualStyles function or the InitVisualStyles.
With the VBCCR16, I had on the top of each form "SetupVisualStyles(me)", isn't this necessary anymore?
Thanks
You shall take VisualStyles.bas from the demo in post #1 of this thread.
Re: CommonControls (Replacement of the MS common controls)
Hello Krool, I'm using the latest compiled version of the ocx (VBCCR17.OCX), and I'm seeing some issues regarding the CheckBoxW:
1) I find no way to disable the focus rect.
I'm using Windows 11 with visual styles enabled (I guess Windows 10 must be the same) and the original VB CheckBox does not show the focus rect when visual styles are enabled.
2) The property "Custom" that is supposed to display the property pages seems to just change the Value property.
3) The property Transparent does not work at design time, but that is probably by design.
PS: I didn't go to check the control's source code.
Last edited by Eduardo-; Jan 30th, 2022 at 10:25 AM.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Eduardo-
Hello Krool, I'm using the latest compiled version of the ocx (VBCCR17.OCX), and I'm seeing some issues regarding the CheckBoxW:
1) I find no way to disable the focus rect.
I'm using Windows 11 with visual styles enabled (I guess Windows 10 must be the same) and the original VB CheckBox does not show the focus rect when visual styles are enabled.
2) The property "Custom" that is supposed to display the property pages seems to just change the Value property.
3) The property Transparent does not work at design time, but that is probably by design.
PS: I didn't go to check the control's source code.
Hi Eduardo,
1) When an app is themed it has no focus rect but it will show focus rects once you use the tab key once on a window. However, this does not work in VB6. That's why the focus rect are forced in the CheckBoxW control via WM_UPDATEUISTATE. Also the VisualStyles.bas uses WM_UPDATEUISTATE on the SetupVisualStyles method for the whole form.
If you have another approach in mind please let me know or discuss it.
2) The Value property is the default property. The CheckBoxW has no property page, that's why the "Custom" is falling back to the Value property.
3) Yes that's ignored at design time. The property description also tells this.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
Hi Eduardo,
1) When an app is themed it has no focus rect but it will show focus rects once you use the tab key once on a window. However, this does not work in VB6. That's why the focus rect are forced in the CheckBoxW control via WM_UPDATEUISTATE. Also the VisualStyles.bas uses WM_UPDATEUISTATE on the SetupVisualStyles method for the whole form.
If you have another approach in mind please let me know or discuss it.
I would have to study what you are saying.
I just wanted to put some CheckBoxes with no caption, and I got this:
For now I solved it by making the CheckBoxes narrower enough.
Originally Posted by Krool
2) The Value property is the default property. The CheckBoxW has no property page, that's why the "Custom" is falling back to the Value property.
When an UserControl has no property page, the "Custom" property does not appear at the property page.
I checked and the CheckBoxW has defined three property pages:
At UserControl_Initialize.
I think one solution might be to call it at UserControl_InitProperties and UserControl_ReadProperties but only when Ambient.UserMode is False.
Originally Posted by Krool
3) Yes that's ignored at design time. The property description also tells this.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Eduardo-
When an UserControl has no property page, the "Custom" property does not appear at the property page.
I checked and the CheckBoxW has defined three property pages:
At UserControl_Initialize.
I think one solution might be to call it at UserControl_InitProperties and UserControl_ReadProperties but only when Ambient.UserMode is False.
I found out the reason. The (Custom) item raises IPerPropertyBrowsingVB::GetPredefinedStrings with an DispID of 0.
But since the Value property is the default property it also has a DispID of 0... (const DISPID_VALUE; 0)
So, it's unfortunate but I think it can be only fixed by using an Enum (As Long) instead of having the property As Integer currently.
But that would break VBCCR17 compatibility. So it's unlikely to be changed. And it's anyway just a minor glitch as there is no real property page behind anyway.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
I found out the reason. The (Custom) item raises IPerPropertyBrowsingVB::GetPredefinedStrings with an DispID of 0.
But since the Value property is the default property it also has a DispID of 0... (const DISPID_VALUE; 0)
So, it's unfortunate but I think it can be only fixed by using an Enum (As Long) instead of having the property As Integer currently.
But that would break VBCCR17 compatibility. So it's unlikely to be changed. And it's anyway just a minor glitch as there is no real property page behind anyway.
IDK what that call does, I mean Call SetVTableHandling(Me, VTableInterfacePerPropertyBrowsing)
What is the purpose?
Re: CommonControls (Replacement of the MS common controls)
I tried this and it worked as expected without error:
Code:
Option Explicit
Private Sub Form_Click()
Me.ListView1.ColumnHeaders(1).Width = 10000
End Sub
Private Sub Form_Load()
Me.ListView1.ColumnHeaders.Add , , "A"
Me.ListView1.ColumnHeaders.Add , , "B"
Me.ListView1.ColumnHeaders.Add , , "C"
Me.ListView1.View = LvwViewReport
End Sub
Re: CommonControls (Replacement of the MS common controls)
Hi,
I have the sub main call the main form of the application, an MDI frm, but it doesn't even show the form giving "Run-time error 440: Automation error"
My problem is that this only happens on some PCs, one of them has Windows 7 and I found out that reducing the colour depth it stopped giving this problem. But I am now trying to run it on a Windows Server 2003 and can't get it to work.
Does anyone have any ideas about what can be happening?
Re: CommonControls (Replacement of the MS common controls)
Found it... I have a toolbar linked to imagelists with the icons I need. The last two icons had a colour depth bigger than the others and older PCs couldn't cope with that.
Since the automation error was being shown in a window with VBCCR17 in the title, I never thought that could be the problem.
Re: CommonControls (Replacement of the MS common controls)
Hello Krool, thanks making and maintaining these controls! I have two questions/issues; apologies if these have been covered.
ComboBoxW - is there a reason that the Text property isn't the default?
MonthView - the latest version is better than the 1.5 version I was using previously, but when setting VisualStyles = False, the runtime size is still not quite the same size as the design-time size. Testing at normal DPI, font = Arial Regular 10.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by hausman
ComboBoxW - is there a reason that the Text property isn't the default?
MonthView - the latest version is better than the 1.5 version I was using previously, but when setting VisualStyles = False, the runtime size is still not quite the same size as the design-time size. Testing at normal DPI, font = Arial Regular 10.
ComboBoxW - That's a bug! The VB.ComboBox has a hidden [_Default] property that redirects to the Text property. The VB.Label has the same logic and the LabelW control considered that but unfortunately not for the ComboBox...
Will look to fix that, hopefully possible for VBCCR17 without breaking.
MonthView - maybe the IDE is not manifest and links to comctl. 5.8x and the compiled executable has a manifest and is linked to comctl. 6.x. (even if both are not themed [VisualStyles = False] the controls are different)
What you mean with DateDblClick ? Please more context on that one.
Re: CommonControls (Replacement of the MS common controls)
Update released.
Included the GetTextRange function in the RichTextBox control.
Included [_Default] property in ComboBoxW/FontCombo/VirtualCombo/ImageCombo.
The MS ImageCombo doesn't have a default property, but I think it is of no harm to make the .Text property as the default member there as well.
The OCX VBCCR17 was also updated. The internal type lib version is now 1.2.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
ComboBoxW - That's a bug! The VB.ComboBox has a hidden [_Default] property that redirects to the Text property. The VB.Label has the same logic and the LabelW control considered that but unfortunately not for the ComboBox...
Will look to fix that, hopefully possible for VBCCR17 without breaking.
FYI, I had changed the Attribute Text.VB_UserMemId = 0 to accomplish this. Not sure which method is best.
Originally Posted by Krool
MonthView - maybe the IDE is not manifest and links to comctl. 5.8x and the compiled executable has a manifest and is linked to comctl. 6.x. (even if both are not themed [VisualStyles = False] the controls are different)
Sorry, yes, you are correct. The EXE is running with a manifest, while the IDE is not. I think I remember seeing an article about putting a manifest on the IDE EXE... I'll look into that.
Originally Posted by Krool
What you mean with DateDblClick ? Please more context on that one.
DateDblClick is an event in the stock MonthView control in Common Controls 2. Private Sub MonthView1_DateDblClick(ByVal DateDblClicked As Date). It comes in handy when using the MonthView as a pop-up control, and double-clicking on the date selects it and closes the popup.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by hausman
FYI, I had changed the Attribute Text.VB_UserMemId = 0 to accomplish this. Not sure which method is best.
DateDblClick is an event in the stock MonthView control in Common Controls 2. Private Sub MonthView1_DateDblClick(ByVal DateDblClicked As Date). It comes in handy when using the MonthView as a pop-up control, and double-clicking on the date selects it and closes the popup.
The Text property cannot have the DISPID_TEXT and DISPID_DEFAULT at the same time. Thus the hidden helper property.
DateDblClick - ooh missed that one. However, the MonthView (SysMonthCal32 window) doesn't have the CS_DBLCLKS style, so it won't fire any WM_LBUTTONDBLCLK.
Re: CommonControls (Replacement of the MS common controls)
hi krool
i wanted to Create a ComboBox inside a Listview as the demo in the link but it is not possible.
The demo works fine with the MS common listview
Public Sub GetLVCellData(pobjLV As ListView, _
psngX As Single, _
psngY As Single, _
ByRef pstrCellText As String, _
ByRef plngItemIndex As Long, _
ByRef plngSubItemIndex As Long)
Dim HTI As LVHITTESTINFO
Dim lst As ListItem
With HTI
.pt.X = (psngX \ Screen.TwipsPerPixelX)
.pt.Y = (psngY \ Screen.TwipsPerPixelY)
.Flags = LVHT_ONITEM
End With
SendMessage pobjLV.hwnd, LVM_SUBITEMHITTEST, 0, HTI
If (HTI.iItem > -1) Then
Set lst = pobjLV.ListItems(HTI.iItem + 1)
plngItemIndex = HTI.iItem + 1
plngSubItemIndex = HTI.iSubItem
If HTI.iSubItem = 0 Then
pstrCellText = pobjLV.ListItems(HTI.iItem + 1).Text
Else
pstrCellText = pobjLV.ListItems(HTI.iItem + 1).SubItems(HTI.iSubItem)
End If
Else
pstrCellText = ""
plngItemIndex = 0
plngSubItemIndex = 0
End If
End Sub
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Mustaphi
hi krool
i wanted to Create a ComboBox inside a Listview as the demo in the link but it is not possible.
The demo works fine with the MS common listview
Public Sub GetLVCellData(pobjLV As ListView, _
psngX As Single, _
psngY As Single, _
ByRef pstrCellText As String, _
ByRef plngItemIndex As Long, _
ByRef plngSubItemIndex As Long)
Dim HTI As LVHITTESTINFO
Dim lst As ListItem
With HTI
.pt.X = (psngX \ Screen.TwipsPerPixelX)
.pt.Y = (psngY \ Screen.TwipsPerPixelY)
.Flags = LVHT_ONITEM
End With
SendMessage pobjLV.hwnd, LVM_SUBITEMHITTEST, 0, HTI
If (HTI.iItem > -1) Then
Set lst = pobjLV.ListItems(HTI.iItem + 1)
plngItemIndex = HTI.iItem + 1
plngSubItemIndex = HTI.iSubItem
If HTI.iSubItem = 0 Then
pstrCellText = pobjLV.ListItems(HTI.iItem + 1).Text
Else
pstrCellText = pobjLV.ListItems(HTI.iItem + 1).SubItems(HTI.iSubItem)
End If
Else
pstrCellText = ""
plngItemIndex = 0
plngSubItemIndex = 0
End If
End Sub