I had the same problem a while ago, but it was solved some weeks ago for me.
Could you post your project that shows the error?
I would like to see if it happens here as well.
Printable View
See post #2117.
http://www.vbforums.com/showthread.p...=1#post5332087
I could reproduce the scenario which causes this problem and it is such a strange and tricky .
https://www.youtube.com/watch?v=IaxZ...ature=youtu.be
I was limited to 15 minutes of recording so , there is an uncompleted test result at the end of the video but it should be enough to make the point clear for now .
Summary for video :
The scenario :
1- Add a new user control
2- Place normal textbox or any VB6 intrinsic controls in the user control .
3- Place any VBCCR control in the user control
4- In the UserControl_Initialize event , add these lines of code .
Lets say you used a VB intrinsic Textbox and a VBCCR CommandButtonW . Add these lines
5- The problem happensCode:text1.text="Hello"
commandbuttonw1.caption ="Hello"
6 - Uncomment the code , The problem now disappears .
7 - Put the following code in the same event
8 - With this previous case , the problem does not happen .Code:Dim s as string
s= "Hello , I prove that not all code causes the problem , It is only for the code that draws an item in the user control"
More details and tests are found in the video for tests on the ComCtlsDemo project
Thanks everybody for your help and sorry for bad English .
Easy to reproduce, and happens in here the same way.
While the effect is bothering, it is more a cosmetic issue.
I lived with it for a long time, and it didn't stopped me to get things done.
But good to point out the issue!
And I would appreciate a solution as well.
It's a very bad idea to make some code involving the child usercontrol in the host usercontrol inside the UserControl_Initialize() event. The UC Ambient.UserMode property is not meaningful at that place. Please set your code that involves the child usercontrols in the UserControl_ReadProperties()/UserControl_InitProperties().
Krool, thank you for these superb usercontrols. In terms of DTPicker there is AllowUserInput, but this property does not 'lock' control fex. like in vb intrinsic combobox locked property does - maintaining control look like 'enabled'. Hence asking is your DTPicker control possible to set 'locked' state, without disabling it? If not, then could you consider adding locked property?
I need to change the BackColor of a tab control but it has no BackColor property. Is this an accidental omission or is there a technical reason for this?
Update released.
Minor bugfix in each WM_MOUSEACTIVATE handler.
This is a very tiny behavior "bug" which I didn't notice and obviously nobody else. :)
The standard handler of WM_MOUSEACTIVATE looked like below (taken from TextBoxW)
and used MA_NOACTIVATEANDEAT when hittest the border or the Validate event doesn't allow to.
However, it is more correct to use MA_ACTIVATEANDEAT.
Because let's assume you have a TextBoxW which can't get focus because the currently focused control doesn't allow. (Validate Cancel = True)Code:Case WM_MOUSEACTIVATE
Static InProc As Boolean
If TextBoxTopDesignMode = False And GetFocus() <> TextBoxHandle Then
If InProc = True Or LoWord(lParam) = HTBORDER Then WindowProcControl = MA_NOACTIVATEANDEAT: Exit Function
Select Case HiWord(lParam)
Case WM_LBUTTONDOWN
On Error Resume Next
With UserControl
If .Extender.CausesValidation = True Then
InProc = True
Call ComCtlsTopParentValidateControls(Me)
InProc = False
If Err.Number = 380 Then
WindowProcControl = MA_NOACTIVATEANDEAT
Else
SetFocusAPI .hWnd
WindowProcControl = MA_NOACTIVATE
End If
Else
SetFocusAPI .hWnd
WindowProcControl = MA_NOACTIVATE
End If
End With
On Error GoTo 0
Exit Function
End Select
End If
Then assume the form get's inactive (for instance when clicking on desktop) then now when you click on the TextBoxW which is not allowed to get focus you will see that the Form will not get active. But in VB.TextBox the form will get active where the focus is still on the upper TextBox which have Validate Cancel = True.
Attachment 166999
So this update brings the behavior to same. I know it's a very tiny detail.
as Info: the MA_NOACTIVATE in above WM_MOUSEACTIVATE handler is still correct as SetFocusAPI implies activation of the top-level form. (SetFocusAPI internally also activates the form)
Hello Krool,
I found a bug.
I have a form with 200 texbox from vb6.
When i convert my project from VBCCR6 to Source code CommonControls, in the moment when I compiling the project I obtein a error , runtime '0' , the haven't a licence from your control.
Hello Krool,
I use MzTools 3.0 ( https://programacion.net/noticia/mzt...ual_basic_1751 ) and the properties "Fontname" in TextboxW is missing.
The TexBox default have a properties "FontName".
Could you fix this?
Attachment 167753
Attachment 167755
Update released.
Bugfix in the internal ComCtlsTopParentValidateControls function.
If a control validation takes place in an MDIForm it was functional working, but it had a strange "re-position" effect on mdi-child forms.
Below illustration says more than words..
Before
http://krool.mooo.com/Data/VBForums/...ols_Before.gif
After fix
http://krool.mooo.com/Data/VBForums/...rols_After.gif
It could be fixed by just adding red marked code block:
VB.Form is inherited in each VB.MDIForm. However, it seems to work "better" if .ValidateControls is called on the VB.MDIForm directly.Code:Public Sub ComCtlsTopParentValidateControls(ByVal UserControl As Object)
With GetTopUserControl(UserControl)
If TypeOf .Parent Is VB.MDIForm Then
Dim MDIForm As VB.MDIForm
Set MDIForm = .Parent
MDIForm.ValidateControls
ElseIf TypeOf .Parent Is VB.Form Then
Dim Form As VB.Form
Set Form = .Parent
Form.ValidateControls
Else
Const IID_IPropertyPage As String = "{B196B28D-BAB4-101A-B69C-00AA00341D07}"
If VTableInterfaceSupported(.Parent, IID_IPropertyPage) = True Then
Dim PropertyPage As VB.PropertyPage, TempPropertyPage As VB.PropertyPage
CopyMemory TempPropertyPage, ObjPtr(.Parent), 4
Set PropertyPage = TempPropertyPage
CopyMemory TempPropertyPage, 0&, 4
PropertyPage.ValidateControls
End If
End If
End With
End Sub
So it's not a real functional bugfix but rather a cosmetic fix.
VBFlexGrid is likewise updated.
Hello Krool,
I have an error in TextBoxW
Attachment 168249
In line Of TextBoxW:
Code:Public Property Set Container(ByVal Value As Object)
Set Extender.Container = Value
End Property
My code is:
Code:Private Sub ZoomControls(miTxt As TextBoxW, miLb As LabelW, miFrame_1 As FrameW)
Set miTxt.Container = miFrame_1
End Sub
With the OCX Controls, i haven't the error.
Krool,
This is the example the error.
Add This form to ComCtlsDemo Project
Attachment 168251
In the OCX the FrameW interface is an amalgamation of VBControlExtender and the real FrameW interface.
Whereas in the Std-EXE version the FrameW interface is encapsulated. However, when using FrameW1 on the control itself it contains VBControlExtender, but not when passed to a sub with As FrameW.
Solution could be to not pass FrameW into the sub but VBControlExtender.
Changed:
Unchanged:Code:Private Sub ZoomControls(miTxt As TextBoxW, _
miLb As LabelW, _
miFrame_1 As VB.VBControlExtender)
Code:Private Sub cmdZoomURL_Click()
Call ZoomControls(txtUrl, lbURL, Frame(1))
End Sub
Thank you very much!!
It's working
Problem:
1) Download Demo from first post in this thread
2) Copy contents of OLEGuids to Windows\System32
3) Open VB6
4) Open ComCtlsDemo.vbp (loads without issue)
5) Run
VB6 closes
Same thing happens when I try and open MainForm.frm in the IDE
Any ideas?
I had to google registering a TLB... never heard of TLB's and I have no clue on how to register them. I can't see it mentioned anywhere in the readme. But I googled, found out how to register a TLB and got it registered.
Unfortunately now the project won't run.
Really a shame that the demo for this project won't run and there's really no mention of at least two critical steps to get the demo running. It must turn a lot of people off using it. But I'm determined to stick with it for a bit longer before I give up.
When I try and run the project I see this:
Attachment 168377
In Debug I see this line highlighted:
Attachment 168379
If the demo needs a manifest, shouldn't it be included? Where can I get one and/or make one for this project?
It is mentioned in the GitHUb readme: "In order to use that type library, it is necessary to load the OLEGuids.tlb in the IDE. (Project -> References... -> Browse -> select file OLEGuids.tlb -> check item "OLE Guid and interface definitions")", but Googling works too so glad you got that part figured out and working.
I suspect it doesn't include the manifest because it is actually outside the scope of the project, and is something most devs have done as a matter of course years ago. The VB6 IDE needs to be manifested to use the newer V6 common controls. Search for "manifest vb6 ide" for a bunch of results on how to do this. Here are a few articles I found with those search terms that might be helpful:
http://vbnet.mvps.org/code/forms/vbidevista.htm
http://www.vbaccelerator.com/home/VB...VB/article.asp
Well if the purpose of a demo is to show you how easy it will be to use... mission accomplished. The instructions are hidden on GitHub? You have to Google menifest creation in order to try out the demo?
Somebody put a ton of work into this. Much better than many commercial products and very necessary with Microsoft constantly playing games. Really a shame the demo is so poor that it won't run out of the box. Especially since all you would need to do is edit the readme and give people a hint on how to run it.
I didn't see that purpose stated the documentation ;)
I think the purpose of the demo was to showcase the available controls, and the purpose of the project in general is to provide Unicode replacements for the ANSI common controls used by default by VB6. Nobody said that would be easy! You need to weigh your need for Unicode controls vs. the work required to get them up and running in your environment. I assure you that Krool has done the vast majority of the really hard work compared to writing your own Unicode control replacement library. Registering a TLB and adding a manifest to your VB6 IDE is a small step above the absolute minimum that can be expected from a developer to get an OCX working from source.
darkbob,
You do not need a manifest in order to run the demo. The only thing you need is to reference the OLEGuids.tlb file in your project. BTW, the .tlb means it is a type library. It enables VB6 to be able to specify data types, call stack order etc. differently than what is built-in to VB6. It is a powerful feature that is used all the time in VB6; normally it is behind the scenes.
Krool included the latest OLDGuids.tlb in the OLEGuids folder of the package yo downloaded. You can reference it there. Alternatively, I keep the ltest version in C:\Windows\SysWow64 (C:\Windows\System32if you are running 32-bit Windows). It hasn't changed in 2 years so it isn't much of a hassle to put it in the common folder.
You don't need to register it. Let's say you copied it to C:\Windows\SysWow64. In a blank VB6 project go to Project | References then click on Browse. Go find it and include it in your project. Now it will be available for all future projects you do. Just do Project | References and look for "OLE Guid and interface definitions" and check the choice.
Know also that the type library is only used when you are in the IDE &/or compiling. It is not required to be included with the final distribution program. So it is just a file you will want to keep n your development machine. It allows you to do a lot of interesting things as Krool's demo will show you.
That's all you need to run his demo or to use his controls.
You will probably notice that all of his controls are included in the demo are source files. Typically controls are distributed pre-compiled in a .OCX file and you never see the source files. The advantages of what Krool has done here is that once you get it compiled you no longer need the control files; they're compiled into your code.
There is another version of his controls where he has pre-compiled everything into one large .OCX file (read the first post of his to find the link to the thread containing that OCX file). If you go this route your compiles are faster because you dn't have to compile the source code for the controls each time but when you have your final EXE file you have to distribute that OCX with it. [That's where the side-by-side stuff can start coming into play but that's a topic for another day.]
Let us know how all of this works for you. Krool has put in some incredible work here and I hope you can benefit from it as we have.
Please make the following setting in your VB6 IDE to not crash the IDE when it is not manifested.
In order to trap error raises via "On Error Goto ..." or "On Error Resume Next" it is necessary to have "Break on Unhandled Errors" selected instead of "Break in Class Module" on Tools -> Options... -> General -> Error Trapping.
Hello Krool,
great job. I have a question. Can these controls work in 64bit VBA?
Thanks a lot for reply.
Pablo72
Yes, I know... but I was hoping that comctl32.dll (as the basis of these controls) can be used on 64bit application..maybe :)
The problem is that next release of sotware (with integrated VBA) we administrate will be 64-bit only :( .. So I'm looking for some solution..
Anyway, thanks for quick reply.
Hi krool ,
In commandbuttonW , the dropdown event is not fired with the property SplitButton set to true and property SplitButtonNoSplit set to true .
Is this an intrinsic MS behavior ,intended or a bug ?
Hello Krool, it is suggest that ImageList can save the image list and open the image list, and it is perfect if PNG is supported when adding images.
Attachment 169283
How delete own post...
Yes, Krool, so if you don't need to re-add it when other projects are used, just open the saved image list file.