-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Returning to VB6 programming after a long break, I decided to undertake the task of replacing my current implementation of controls with VBCCR (I already use VBFLXGRD since ver. 1.4) and after several days of handy work switching between my text editor and the VB6 IDE I have completed the whole thing without any direct issues. However, there are a few differences between my old and the new VBCCR1.8 controls I'm not sure how to address e.g. making structural changes to my code or make a request for function enhancement. I post here as I'm using the OCX version although I'm aware of that stuff gets implemented in the Std-Exe version first.
From what I've been able to conclude so far there are currently 3 things I am missing in the VBCCR18 controls:
1. A ListIndexChange() Event in the Combo- and ListBox controls, which is useful as it allows for differentiation between if the index changed due to the user clicked an item in the control or if it changed due to programmatic reasons.
2. In the ComboBox only, a BeginEdit() and EndEdit() Events which fires when user starts typing in Edit portion of controls and finishes the edit operation. The EndEdit Event may come with several arguments, like a boolean for if a change really took place, a string for the new value and reason for the end (eg. user pressed return, focus was killed, Escape pressed, control was dropped), the Index may also be useful to get.
3. The ability for Label control to render some HTML assigned to the Caption, or a dedicated HtmlCaption, property. Doesn't need to be full fetched html just the most common and useful formatting stuff. Well, doesn't need to be html, that's just what my old control offered, but the idea is that you can have a ready made html formatted string w/ placeholders to fill from code and display in a typical "label situation".
Maybe there is such a control already but I haven't been able to find any here. The Combo and Listbox functionalities are more important to me though, so question is if this is something that could be added to the control suite or not?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Feature request: it would be nice to include different underline styles like wave, double underline, etc. I think it is quite easy to include (but my apologies if I am wrong), because now I accomplish it this way:
Code:
Dim iStart As Long
Dim iLen As Long
iStart = rtfTest.SelStart
iLen = rtfTest.SelLength
rtfTest.SelUnderline = True
rtfTest.SelColor = vbRed
rtfTest.SelRTF = Replace(rtfTest2.SelRTF, "\ul", "\ulwave")
rtfTest.SelStart = iStart
rtfTest.SelLength = iLen
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Hi krool,
im still using VBCCR v1.7.104 and want to upgrade to v1.8.x
Is the upgrade as simple as unregister v1.7 and register v1.8 to continue with my vb-projects?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Mith
Hi krool,
im still using VBCCR v1.7.104 and want to upgrade to v1.8.x
Is the upgrade as simple as unregister v1.7 and register v1.8 to continue with my vb-projects?
Yes it should be very smooth from 1.7 to 1.8.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
Yes it should be very smooth from 1.7 to 1.8.
It doesnt work. I unregister v1.7 and registered v1.8. After i started one project i got error messages about the missing v1.7...
I replaced the v1.7 with v1.8 in the main vbp file but after loading the project again i got error messages for each form in the project...
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Mith
It doesnt work. I unregister v1.7 and registered v1.8. After i started one project i got error messages about the missing v1.7...
I replaced the v1.7 with v1.8 in the main vbp file but after loading the project again i got error messages for each form in the project...
Yes the uuid needs to be replaced in each form.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
Yes the uuid needs to be replaced in each form.
And all v1.7 references in the code! e.g. "Dim NodeX As VBCCR17.LvwListItem".
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Instructions to upgrade v1.7 to v1.8:
1. Don't unregister v1.7, so no-converted projects and compiled exe files will still work
2. Register v1.8
3. Use the free app OCX updater to convert your project: https://10tec.com/vb6-project-references-update/
4. Optional: edit your project manifest and replace v1.7 with v1.8 (see VBCCR18SideBySide.res)
5. Open your project and hit CTRL+F5 to test the code changes.
6. Compile your project and run the compiled exe.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
There is no guide on how to make an isolated ocx, I would like to add a background image to the richTextBox, and I don't want to compile all the ocx into one, I have tried to open a usercontrol, add the RichTextBox.ctl, the RichTextBoxBase.bas and the PPRichTextBoxGeneral.pag, I click on create the modified Ocx, and all are errors... Declarations are missing and I don't know what else...
Is there not a guide, please, to be able to convert and modify from VB6 any of the ocx in particular?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
James Reynolds
There is no guide on how to make an isolated ocx, I would like to add a background image to the richTextBox, and I don't want to compile all the ocx into one, I have tried to open a usercontrol, add the RichTextBox.ctl, the RichTextBoxBase.bas and the PPRichTextBoxGeneral.pag, I click on create the modified Ocx, and all are errors... Declarations are missing and I don't know what else...
Why dont you add the missing declarations to your new project? Or use the original VBCCR source code and remove all controls you dont need...
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Mith
Why dont you add the missing declarations to your new project? Or use the original VBCCR source code and remove all controls you dont need...
Sorry Mitch, I solutioned yesterday in the night, fault some bas archives... Thanks for your answer!!!
Another question, ChatGPT, although he is terrible at writing code according to my criteria, because he asks very simple things and I go on and on and on, and then I find a much simpler solution here or by writing code myself, an example, I asked him how to make a richTextBox be completely Locked, not enabled = false, because then the color of the letters changes, and after a lot of thinking, the solution was very simple, in the GotFocus event, set SetFocus to another control, and the nonsense was over, not cursor into the richtextbox, no blink into the control, nothing all...
But I found the solution myself, ChatGPT messing around in many places, and when I see that it's going crazy, I come back here or I try to program it myself...
But well, as a database for information on things that are not very complex, ChatGPT it is quite useful, and I asked him some time ago if Google Translate could be easily integrated into VB6, in the browser, and he told me not much, and well, but he gave me information on how to translate online from VB6, and I wonder, an idea for Krool:
Quote:
WHY NOT INCLUDE THAT CAPABILITY IN THE LABELW, COMBOW, LISTW, ETC...???
And wouldn't there be some TTS that could be included?
What about having, for example, properties like LangFrom and LangTo, TextFrom and TextTo and ShowTextFromOrTo in unicode controls that translate internally?
It wouldn't work to translate deep philosophy, but for many programs they are very simple things, in the labelw for example, they are usually very simple words that are put, and having a translation for any language that is spoken in Langto, can be of great convenience when making a multilingual program!!!
And there also has to be a way to include - although perhaps more complex because of having to include many TTS voices from many languages, that can already be a big handicap - some TTS...
It would be a luxury to have these options, at least the internal translation, then I'll look at what ChatGPT told me about how to translate from VB6 and I'll put it here - ChatGPT paid, it's 20US$ per month, it's not much really, it's useful (although not very useful at all) -...
Greetings, how do you see it?
-
1 Attachment(s)
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
I just finished converting native vb6 controls to VBCCR18.
While the VBCCR18 controls indeed display chinese characters properly, their ToolTipText property shows ? instead of foreign (e.g. Chinese) characters.
Is this a known issue?
Attachment 193484
-
2 Attachment(s)
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
The CommonDialog suffers from a similar problem.
As shown in the image below, it allows selection of a file name with Chinese characters:
Attachment 193489
But it returns a mangled FileName (?? instead of UNICODE characters):
Attachment 193490
And testing if that mangled FileName exists returns False.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Condor3,
The ToolTipText property is VB6's ToolTipText property and thus is still ANSI. It is easy to deploy your own tooltip.
Regarding the CommonDialog. The attachements do not work. Also I can't replicate your issue. For me the returned file name has the unicode chars in it.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Thanks, Krool!
I updated the post above to show the images. The code I'm using boils down to:
Code:
Dim gcdg As VBCCR18.CommonDialog
Set gcdg = New VBCCR18.CommonDialog
gcdg.flags = CdlOFNFileMustExist Or CdlOFNAllowMultiSelect Or CdlOFNExplorer
gcdg.Filter = "Crystal Reports (*.rpt;*.rpz)|*.rpt;*.rpz|Excel Files (*.xlsx;*.xls)|*.xlsx;*.xls|SQL Files (*.sql)|*.sql"
gcdg.FilterIndex = 1
gcdg.MaxFileSize = 32000
gcdg.ShowOpen
If FileExists(gcdg.FileName) Then ...
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
On the tooltip issue, please consider adding a UNICODE ToolTipW property to your controls.
For example, HexaGora controls maintain the old ToolTipText property (for backward compatibility, I assume).
But they also add a nice Tip property that supports UNICODE and other useful properties (such as Tip font size).
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Condor3
Thanks, Krool!
I updated the post above to show the images. The code I'm using boils down to:
Code:
Dim gcdg As VBCCR18.CommonDialog
Set gcdg = New VBCCR18.CommonDialog
gcdg.flags = CdlOFNFileMustExist Or CdlOFNAllowMultiSelect Or CdlOFNExplorer
gcdg.Filter = "Crystal Reports (*.rpt;*.rpz)|*.rpt;*.rpz|Excel Files (*.xlsx;*.xls)|*.xlsx;*.xls|SQL Files (*.sql)|*.sql"
gcdg.FilterIndex = 1
gcdg.MaxFileSize = 32000
gcdg.ShowOpen
If FileExists(gcdg.FileName) Then ...
I assume it's the FileExists function which does not support unicode. Can you post me your FileExists code?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Thanks, Krool! I was using an ANSI method to check for FileExists.
Switching to a method that supports UNICODE fixed the problem.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Condor3
Thanks, Krool! I was using an ANSI method to check for FileExists.
Switching to a method that supports UNICODE fixed the problem.
See here https://github.com/Kr00l/VBCCR/blob/...mon/Common.bas for a unicode FileExists function. To note is that GetAttr is "overloaded" as well in this Common.bas so that it supports unicode.
Also MsgBox is overloaded to support unicode. This way you can verify your FileName instead of debug.print which is obviously ANSI only.
-
3 Attachment(s)
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Problem: TextBoxW adds typed chars on left. Here is what I get when typing abc:
Attachment 193496
Relevant properties of the TextBoxW control:
Attachment 193497
Note that doing the same typing in a VBCCR18.RichTextBox works just fine:
Attachment 193498
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Condor3
Ok, which region/locale do you have ?
Is it fixed when you set it to Off in the TextBoxW IMEMode property?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Region: United States.
Language: English (United States). No other language installed.
Keyboard: English (United States)
Windows 10
Setting IMEMode to 2-CCEIMEModeOff doesn't solve the problem.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
When you right-click on the TextBoxW. Do you see right-to-left checked on the context menu?
-
1 Attachment(s)
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
No, that option is not checked:
Attachment 193500
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Do you have any code influencing the selection in the TextBoxW? Does it happen in a blank project? Does it happen on the VB.TextBox ?
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
All my TextBoxW (and RichTextBox) controls were converted to VBCCR18 by changing the references inside the .frm files.
I just tested adding a new TextBoxW control and it behaves fine!
So something about the converted TextBoxW controls is causing the problem.
This is surprising because the converted RichTextBox controls behave properly.
In terms of code impacting the selection in the control, the converted controls have Ole drag drop code like this:
Code:
Private Sub TextBoxW1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFUnicode) Then
TextBoxW1.SelText = Data.GetData(vbCFUnicode)
ElseIf Data.GetFormat(vbCFText) Then
TextBoxW1.SelText = Data.GetData(vbCFText)
End If
End Sub
But enabling manual drop and using the same code in the new TextBoxW control doesn't cause the problem.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
RTL typing Problem solved!
The Changed event of the TextBoxW called a function to update the tooltip. That function also Left-Trimmed the text:
Code:
TargetControl.Text = LTrim$(TargetControl.Text)
That line causes the TextBoxW to reverse typing direction. When commented out, problem is gone.
Thanks for your help in isolating this rather odd bug.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
During OLEDragOver of some text onto a TexBoxW, I need to display a cursor inside the target TextBoxW, reflecting the current dragging mouse position. The sample code located here, works fine with a regular textbox.
But with TextBoxW, the character position returned by the following code always returns 65535, instead of the correct character position under the mouse:
Code:
Public Function TextBoxCursorPos(ByVal txt As TextBoxW, ByVal X As Single, ByVal Y As Single) As Long
X = X \ Screen.TwipsPerPixelX
Y = Y \ Screen.TwipsPerPixelY
' Get the character number
TextBoxCursorPos = SendMessageStr(txt.hWnd, EM_CHARFROMPOS, 0&, CLng(X + Y * &H10000)) And &HFFFF&
End Function
Using a variation to avoid Twips to Pixels conversion makes no difference:
Code:
X = X \ 1
Y = Y \ 1
Please advise on how hovered-over character position in a TextBoxW control can be identified during OleDragOver event.
Thanks!
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Condor3
But with TextBoxW, the character position returned by the following code
always returns 65535, instead of the correct character position under the mouse:
Code:
Public Function TextBoxCursorPos(ByVal txt As TextBoxW, ByVal X As Single, ByVal Y As Single) As Long
X = X \ Screen.TwipsPerPixelX
Y = Y \ Screen.TwipsPerPixelY
' Get the character number
TextBoxCursorPos = SendMessageStr(txt.hWnd, EM_CHARFROMPOS, 0&, CLng(X + Y * &H10000)) And &HFFFF&
End Function
I guess you must use the unicode version of SendMessage:
Code:
Public Declare Function SendMessageW Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Good news! It worked with this variation:
Code:
TextBoxCursorPos = SendMessageW(txt.hWnd, EM_CHARFROMPOS, 0&, X \ Screen.TwipsPerPixelX) And &HFFFF&
Thanks, Mith!
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Simplified problem definition based on further troubleshooting:
Problem: TextBoxW control bound to MS Access via ADO returns wrong .SelStart (always as 0) on first-time lostFocus event. If user clicks back into the TextBoxW and then clicks away, causing another LostFocus event, the LostFocus returns the correct SelStart value.
Solution: Avoid the LostFocus event -- use the Validate event instead. While the LostFocus problem seems like a bug, I'm not going to chase this any further, now that I have a way around the problem.
Additional Info: the problem occurs only if there is no actual selection -- only cursor position. If there is an actual selection, .selStart is correct always.
Background: in the double-click event of a ListBoxW, I inserts the .Text property (text of double-clicked item in ListBoxW) into the TextBoxW control at the SelText position. I grab the selStart position in the LostFocus event of the TextBoxW because the .SelText property is not reliable when there is only a cursor position rather than an actual selection (even though the HideSelection property of the TextBoxW is set to False.
If I use code in the TextBoxW itself (debug.print the .SelStart in the clicked event of the TextBoxW itself), I get the correct value. So the problem occurs only when losing focus (1st time) or when accessing the .selStart property of the TextBoxW from another control (after the TextBoxW has lost focus).
Calling .SetFocus on the receiving TextBoxW from the double-clicked code in the ListBoxW does not solve the problem.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Hello,
RAR file in OP post is corrupt
Can you reup?
Thanks
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
I got it thanks, now I place the OCX in system directory but cannot register it.
Sorry. I just came back to VB after many years and having some hard time getting up to speed.
Thanks
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Perhaps you need to follow the ReadMe.txt about OLEGuids.tlb at the GitHub page.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Thank you I did it but where do I find the new controlsin the IDE. Should I activate these?
The control toolbar did not change
Thank you
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Press CTRL-T and check the desired components
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Having a hard time! The component is checked but no controls available so I try with th OCX and cannot register it and when I browse for it it doesnt appear in system32 dir even if I copy it in there. Not sure why. I got also some messages stating that vb cannot access windows registery.
Ive got luck with the OCX . I had to give admin acces to vb6.exe and after that it works. I should have think to that before. Thanks for the help! Merry Christmas.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
Thank you very much :)
I need to replace classic controls any utility which can replace with 100% accuracy. i need to replace all controls in my vb6 project.
-
Re: [VB6] ActiveX CommonControls (Replacement of the MS common controls)
i m confused why the tlbid and clsid used in regfree manifest are not the same as in tlb?
```[
uuid(6E079084-0EF6-40BD-AB06-AC31FE0BC00A),
version(1.2),
helpstring("VB Common Controls Replacement 1.8 Library"),
helpfile("__VB_HELP__"),
helpcontext(00000000)
]
[
uuid(EF21E8A7-E692-4A01-8189-595B39EBA0F6),
noncreatable
]
coclass Animation {
[default] dispinterface _Animation;
[default, source] interface __Animation;
};```