Re: CommonControls (Replacement of the MS common controls)
You only can archive this goal if you draw your own control using OwnerDraw....
check the VBCCR source code, there is plenty of code how to draw your own controls.
See CheckBoxW.ctl -> WindowProcUserControl -> DrawThemeBackground (this api draws for example the checkbox)
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
i have a problem with the "RightToLeft" property of your controls. For example:
when i set RightToLeft=TRUE only the caption text moves to the right but the checkbox or optionbutton not.
Normally the checkbox or optionbutton should be displayed on the right side of the caption text.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Mith
Hi Krool,
i have a problem with the "RightToLeft" property of your controls. For example:
when i set RightToLeft=TRUE only the caption text moves to the right but the checkbox or optionbutton not.
Normally the checkbox or optionbutton should be displayed on the right side of the caption text.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Mith
You only can archive this goal if you draw your own control using OwnerDraw....
As I said, this is at best a workaround, so I will wait until this is achieved in the base controls, if it isn't then I won't use the control. I do have another workaround in any case.
The issue is that VB6 programs running on 4K+monitors look increasingly puny, you cannot rely on desktop scaling as it has a potential effect on other programs and in any case, I never trust any feature provided by Microsoft to survive very long, deprecation or change...
Also, factor in that running VB6 programs on emulators or via Wine on non-Windows systems means that desktop scaling of controls may simply not be available.
VB6 programs have the possibility to stand on their own using manual scaling but only if the core controls can scale in ratio to the form. Only these tow fail to do so. I am sure that it will be incorporated into the Krool's controls sometime in the future, scaling is a benefit. I just see it as a matter of time - and as I said, I have a workaround.
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
Re: CommonControls (Replacement of the MS common controls)
I found a solution to fix this problem:
i had to set the property "MaxLength" from 0 to 200.000 to enter more text.
The amount of characters in the loaded text files is always below 200.000 chars.
Can you explain how "0" limits the amount of chars you can enter?
Re: CommonControls (Replacement of the MS common controls)
OK, i think i got it now! I found this info:
"When this property is set to 0, the maximum length of the text that can be entered in the control is 64 KB of characters. You can use this property to restrict the length of text entered in the control."
I thought 0 means unlimited or the maximum available amount...
Richtextbox GetLineCount returns a wrong value when using word wrap
VBCCR 1.8.77 VB6SP6
GetLineCount returns 5 using the following text in a Richtextbox and using .ScrollBars = vbBoth:
Code:
Whereas recognition of the inherent dignity and of the equal and inalienable rights of all members of the human family is the foundation of freedom, justice and peace in the world,
Whereas disregard and contempt for human rights have resulted in barbarous acts which have outraged the conscience of mankind, and the advent of a world in which human beings shall enjoy freedom of speech and belief and freedom from fear and want has been proclaimed as the highest aspiration of the common people,
Whereas it is essential, if man is not to be compelled to have recourse, as a last resort, to rebellion against tyranny and oppression, that human rights should be protected by the rule of law,
Whereas the peoples of the United Nations have in the Charter reaffirmed their faith in fundamental human rights, in the dignity and worth of the human person and in the equal rights of men and women and have determined to promote social progress and better standards of life in larger freedom,
Whereas Member States have pledged themselves to achieve, in cooperation with the United Nations, the promotion of universal respect for and observance of human rights and fundamental freedoms,
GetLineCount returns 12 after setting rtfLang.ScrollBars = vbVertical to word wrap the text.
Is this a bug?
How can i get the "real" LineCount of 5 to use .GetLine(i) to get the 5 lines without the word wrap?
Re: CommonControls (Replacement of the MS common controls)
Then you want the number of hard line breaks?
Don’t know whether there’s a method fir that.
You can always check it yourself by examining the .TextRtf or .Text
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Arnoutdv
Then you want the number of hard line breaks?
I found a workaround:
Code:
' Doesnt work correct with word wrap (Scrollbars=vbvertical)
For I = 1 To rtfLang.GetLineCount
Line = rtfLang.GetLine(I)
Next I
' workaround:
Rows = Split(rtfLang.Text, vbCrLf)
For I = 0 To UBound(Rows)
Line = Rows (I)
Next I
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Mith
I found a workaround:
Code:
' Doesnt work correct with word wrap (Scrollbars=vbvertical)
For I = 1 To rtfLang.GetLineCount
Line = rtfLang.GetLine(I)
Next I
' workaround:
Rows = Split(rtfLang.Text, vbCrLf)
For I = 0 To UBound(Rows)
Line = Rows (I)
Next I
Yes EM_GETLINECOUNT works weird in RichTextBox when word wrap is on.
You may split text by vbCrLf when .UseCrLf property is True only. Otherwise it is vbCr or vbLf (don't know now) only.
Re: CommonControls (Replacement of the MS common controls)
Hello,
I'm trying to replace the MSCOMCTL library in MS Access. I've added a TreeView component and I'm attempting to handle an event with the following code:
Code:
Private Sub TreeView_Expand(ByVal Node As VBCCR18.TvwNode)
Debug.Print "Key is" & Node.Key
End Sub
However, when I open the form, I receive an error.
The expression [key up| mouse move|Node click|Mouse up|Click (any of this option)] you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name.
The next events are processed correctly as long as I remove the event Expand.
Code:
Private Sub TreeView_DblClick()
Debug.Print "abcd"
End Sub
Private Sub TreeView_Click()
Debug.Print "abcd"
End Sub
Re: CommonControls (Replacement of the MS common controls)
Did you just change the existing Event handlers from the original Treeview?
You should use the events from the CommonControls TreeView and then add/copy the code from the original TreeView events.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Arnoutdv
Did you just change the existing Event handlers from the original Treeview?
You should use the events from the CommonControls TreeView and then add/copy the code from the original TreeView events.
First, I took my existing forms and replaced components from MSCOMCTL with those from VBCCR, but that approach didn't work.
Now, I created a new form, added a VBCCR18.TreeView component to it, and am trying to adapt old code to these new controls.
But I ran into an issue where the needed event doesn't fire properly. It doesn’t work even on a clean new form without other code or components.
To be honest, VB is not my language, I worked with it over 20 years ago when I was just starting to learn programming from a book, and since then I haven't had any experience with VBA.
So I might’ve missed something important here. Could you please provide me with a minimal example showing how to handle the node expansion event (for instance, display the node's text)?
Re: CommonControls (Replacement of the MS common controls)
I've noticed an issue with the CommandButtonW control. I have them on a panel on an MDI form as the main toolbar. If the focus goes off the form (to another window/application), and the button is then clicked without the MDI form becoming active first, the click event does not fire. The button responds to the visual styles still (hover effect). If I instead click a regular button, the click event is performed, even if the form doesn't have the focus.
i have a feature request for the CheckboxW and the OptionButtonW:
Can you add the existing AutoSize property from the LabelW control to the CheckboxW and the OptionButtonW control?
This can be very useful when having a GUI that is translated into other languages.
The length of the displayed text can be so different in every language and it is a pain in the ass to check all forms with all languages to check no text is truncated.
I think the exisiting core functionality of the AutoSize property from the LabelW control only needs to adapted to the other controls.
i have a feature request for the CheckboxW and the OptionButtonW:
Can you add the existing AutoSize property from the LabelW control to the CheckboxW and the OptionButtonW control?
This can be very useful when having a GUI that is translated into other languages.
The length of the displayed text can be so different in every language and it is a pain in the ass to check all forms with all languages to check no text is truncated.
I think the exisiting core functionality of the AutoSize property from the LabelW control only needs to adapted to the other controls.
What do u think?
It's certainly possible but not trivial, because there is no message or anything which does it for you. So, I would need to code it and check for each style combination do make the best fit. (if MS introduces new styles, the property would get outdated)
So, I would recommend to make a hidden Label and set the Caption and let it autosize and then apply the width of that hidden label plus the "extra width" to your CheckBoxW/OptionButtonW.
According to reactOS the "extra width" would be the checkBoxWidth + text_offset: (for a normal CheckBoxW/OptionButtonW without fancy styles, imagelist etc.)
I've noticed an issue with the CommandButtonW control. I have them on a panel on an MDI form as the main toolbar. If the focus goes off the form (to another window/application), and the button is then clicked without the MDI form becoming active first, the click event does not fire. The button responds to the visual styles still (hover effect). If I instead click a regular button, the click event is performed, even if the form doesn't have the focus.
What is that "panel" for a control ? I can't reproduce it with a simple UserControl control container placed on the MDI form..
Re: CommonControls (Replacement of the MS common controls)
Hello.
I have a question regarding how to use this component with the x64 version of Office. When trying to connect the component, VBA shows that the reference is missing, but that's not true, as the file is in place.
When opening the document, I receive an error:
The expression On open you entered as event property setting produced the following error: A problem occured while <docname> was communication with the OLE server or ActiveX Control.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by mmorzhakov
Hello.
I have a question regarding how to use this component with the x64 version of Office. When trying to connect the component, VBA shows that the reference is missing, but that's not true, as the file is in place.
When opening the document, I receive an error:
The expression On open you entered as event property setting produced the following error: A problem occured while <docname> was communication with the OLE server or ActiveX Control.
Does a version of the component for x64 exist?
The code is x64 ready. However, it can only be compiled to x64 ocx with twinBASIC.
Since twinBASIC is beta and has still known issues there is no pre-compiled x64 ocx yet.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by yereverluvinuncleber
The scaling performed above is being performed in code to allow a form to be scaled dynamically by dragging the corner up or down to resize. All controls are anchored and during a resize event are sized by proportion to the scaling of the whole form.
But what you want isn't normal form/windowscontrols behaviour. When I resize a window I expect to get more room, not controls to resize with it. I made a few controls myself and I never even considered what you want as that isn't normal Windows behaviour. Resizing a window does not scale controls, with regular window forms. That kind of thing is mostly done on windows with external applications making only scale the specified window, as if you had set scaling in windows itself.
Maybe Twinbasic supports it, but that's because they wrote their own controls for their window form behaviour, they're not using standard window controls for that.
Re: CommonControls (Replacement of the MS common controls)
TREEVIEW BUG:
The item with INDEX=10 is selected and in focus state
But when I check other options, the focus will switch, and after checking, it will return to the original focus, causing visual flickering
Re: CommonControls (Replacement of the MS common controls)
Can a new attribute be added to label w and textw: vertical centering.
For example, if the font height is 12 pixels and the control height is 30 pixels, let the font start displaying at the top=9 position
Re: CommonControls (Replacement of the MS common controls)
hello,Krool, can LISTVIEW enhance the modification function? For example, can it be set whether a certain column and a certain row are allowed be modified? You provide the modification call in LISTVIEW, and I can write a two-dimensional array to store the modification flag of each cell in the entire LISTVIEW When I need to modify a certain cell, I can directly call your modification, such as modifying the table header data: LISTVIEW1.LvwColumnHeader.fixrow, column, modification flag)
Modify sub-item: LISTVIEW1.LvwListSubItem.fix(row, column, modification flag). Although are some table controls that can be used, my data is not much, at most a few rows and columns, and the use of listview is also very intuitive. I am forward to your reply.
Re: CommonControls (Replacement of the MS common controls)
LISTVIEW , how to select a cell like excel?
or when CELL SELECT CHANGE (ROW=2,COL=2)
CELL BACK BOLOR=YELLOW?
when CELL SELECT CHANGE (ROW=3,COL=3)
CELL BACK BOLOR=YELLOW?
last cell(2,2).back color=whilte?
How to set the thickness, pixel size, and color of grid lines
How to click on a cell with the mouse and modify the content like a text box
Originally Posted by Gosub60
hello,Krool, can LISTVIEW enhance the modification function? For example, can it be set whether a certain column and a certain row are allowed be modified? You provide the modification call in LISTVIEW, and I can write a two-dimensional array to store the modification flag of each cell in the entire LISTVIEW When I need to modify a certain cell, I can directly call your modification, such as modifying the table header data: LISTVIEW1.LvwColumnHeader.fixrow, column, modification flag)
Modify sub-item: LISTVIEW1.LvwListSubItem.fix(row, column, modification flag). Although are some table controls that can be used, my data is not much, at most a few rows and columns, and the use of listview is also very intuitive. I am forward to your reply.
set/get cell value:
Code:
Public Property Get Cell(ByVal Row As Long, Col As Integer) As String
Cell = ListView1.ListItems(Row).SubItems(Col - 1)
End Property
Public Property Let Cell(ByVal Row As Long, Col As Integer, ByVal vNewValue As String)
ListView1.ListItems(Row).SubItems(Col - 1) = vNewValue
Exit Property
If Col = 1 Then 'MSCOMCTL_ListView
ListView1.ListItems(Row).Text = vNewValue '?1??????N?????????
Else
ListView1.ListItems(Row).SubItems(Col - 1) = vNewValue
End If
End Property
Last edited by xiaoyao; Sep 28th, 2025 at 04:36 AM.
Re: CommonControls (Replacement of the MS common controls)
Often in this thread there was a request of how to apply unicode text to an intrinsic .ToolTipText property.
This module is a lightweight solution that comes without hooks and is IDE safe even without thunks.
It also allows multi-line tool tip texts.
Ensure that InitVBBubbleW is called once. Any valid Form object is enough. It is just needed to ensure that VBBubble class is loaded and the handle is retrieved.
Code:
Private Sub Form_Load()
Call InitVBBubbleW(Me)
End Sub
You can unload it manually by calling ReleaseVBBubbleW. However, this is optional as it will be called automatically.
Code:
Call ReleaseVBBubbleW
Example of setting a unicode text with optional draw flags and with an optional max width of 400 pixels. (if ommited, defaults to -1 which means no limit)
Code:
Const DT_RTLREADING As Long = &H20000
Call SetToolTipTextW(MonthView1, "test" & vbLf & ChrW(5000) & ".", DT_RTLREADING, 400)
Example of retrieving the unicode text.
Code:
Debug.Print GetToolTipTextW(MonthView1)
Setting the .ToolTipText directly is still supported and cause no harm. It will be displayed as ANSI then and is limited to 255 characters, but multi-line still being supported.
To note is that this module is standalone and does not have any dependency.