-
1 Attachment(s)
Re: CommonControls (Replacement of the MS common controls)
Some bugs with the DTPicker:
1) The CheckBox of the DTPicker control appears too big at 120 DPI:
Attachment 184445
The other controls are from your control set too, and they display the checkbox properly.
2) The default date is not the current date.
In my user locale I have this setting: "d/m/yyyy", today it is 23/3/2022 (March 23 of 2022) and the control displays "3/ 1/2022" (January 3 of 2022)
Thanks for your work. It is becoming the default control set to use (specially for globalized programs UI, since that needs Unicode support).
-
Re: CommonControls (Replacement of the MS common controls)
In the CommonDialog object, the ShowFolderBrowser method does not show the new folder button, and there is a flag, but only to hide the button: CdlBIFNoNewFolderButton.
-
Re: CommonControls (Replacement of the MS common controls)
I'm using your component more and more, so I hope you don't mind if I keep reporting bugs and making suggestions.
For having full Unicode replacement, I see that the Kill Statement should be also replaced.
Code:
Private Declare Function DeleteFileW Lib "kernel32.dll" (ByVal lpFileName As Long) As Long
' (VB-Overwrite)
Public Sub Kill(ByVal sFileName As String)
If DeleteFileW(StrPtr(sFileName)) = 0 Then
Err.Raise 70
End If
End Sub
-
Re: CommonControls (Replacement of the MS common controls)
Hello Krool,
I am getting error 35773 with the DTPicker when trying to enter time in 24 hour format.
How can I resolve this?
Thank you!
Edit:
Ok, I found out what is happening.
The DTP was set to use DataFormat "Time"
I was setting the DTP value to TimeSerial(), but I didn't take into consideration, that TimeSerial also returns a default date of 31-12-1899, and the MinDate property wasn't set to at least that (which may be another problem - Errors out if set less)
Otherwise, for me, it works now.
Edit again:
I thought it was working, but the DTP MinDate property doesn't accept a date less than 31-12-1900.
-
1 Attachment(s)
TextBox Validate Event bug
VB6SP6, Win7, VBCCR 1.7.37
hi Krool,
i found an annoying bug using the textbox control inside a picture control:
1. The textbox has the focus with the cursor.
2. now i click on the picture control (parent)
3. The validate event of the textbox is not triggered...
If i use TAB or click on another textbox on the form the validate event of the textbox is triggered!
BTW: The VB-textbox in a picture control still triggers the validate event when i click on the picturebox!
Any ideas how to fix this?
Attachment 184621
-
Re: TextBox Validate Event bug
Quote:
Originally Posted by
Mith
VB6SP6, Win7, VBCCR 1.7.37
hi Krool,
i found an annoying bug using the textbox control inside a picture control:
1. The textbox has the focus with the cursor.
2. now i click on the picture control (parent)
3. The validate event of the textbox is not triggered...
If i use TAB or click on another textbox on the form the validate event of the textbox is triggered!
BTW: The VB-textbox in a picture control still triggers the validate event when i click on the picturebox!
Any ideas how to fix this?
Attachment 184621
I can't replicate with the OCX or std-exe. Can you bundle a demo?
-
1 Attachment(s)
Re: TextBox Validate Event bug
Quote:
Originally Posted by
Krool
I can't replicate with the OCX or std-exe. Can you bundle a demo?
Attached you will find my demo project.
How to reproduce instructions:
1. click inside the TextBoxW control
2. now click on the picture control under the TextBoxW
3. the validate event doesnt trigger and no msgbox will show up
1. click inside the VB-TextBox control
2. now click on the picture control under the VB-TextBox
3. the validate event works and a msgbox will show up
goofy:
1. click inside the TextBoxW control
2. now click inside the VB-TextBox control
3. now the validate event works and a msgbox will show up!
BTW:
i tested this inside the IDE and with a compiled exe. both the same results. tested with win7x64.
-
Re: CommonControls (Replacement of the MS common controls)
Mith,
it looks like a VB6 bug itself.
When I place a new innocent UserControl on a PictureBox it has the same issue.
Maybe others may comment on this VB6 bug. It should be a known issue somehow.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
it looks like a VB6 bug itself.
When I place a new innocent UserControl on a PictureBox it has the same issue.
Thanks for the information!
In this case the use of the validate event is complete useless...
I got some bug reports from users and never understood why!
Now i understand it, because the validation code for the textbox content was never triggered!
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
Maybe others may comment on this VB6 bug. It should be a known issue somehow.
i found an answer at StackOverflow
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
clintc
Hello Krool,
I am getting error 35773 with the DTPicker when trying to enter time in 24 hour format.
How can I resolve this?
Thank you!
Edit:
Ok, I found out what is happening.
The DTP was set to use DataFormat "Time"
I was setting the DTP value to TimeSerial(), but I didn't take into consideration, that TimeSerial also returns a default date of 31-12-1899, and the MinDate property wasn't set to at least that (which may be another problem - Errors out if set less)
Otherwise, for me, it works now.
Edit again:
I thought it was working, but the DTP MinDate property doesn't accept a date less than 31-12-1900.
The MinDate for DTP is 01-01-1900 and MaxDate is 31-12-9999.
Quote:
Originally Posted by
Eduardo-
Some bugs with the DTPicker:
1) The CheckBox of the DTPicker control appears too big at 120 DPI:
Attachment 184445
The other controls are from your control set too, and they display the checkbox properly.
2) The default date is not the current date.
In my user locale I have this setting: "d/m/yyyy", today it is 23/3/2022 (March 23 of 2022) and the control displays "3/ 1/2022" (January 3 of 2022)
Thanks for your work. It is becoming the default control set to use (specially for globalized programs UI, since that needs Unicode support).
1) I have no influence about the appearance on high DPI for the DTP.
2) You may set the today's date at Form_Load.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Mith
That is VB.Net code. If the problem is the same one you're having then it might not even be a VB6 problem but it is instead a Windows problem, specifically a problem with the Common Controls.
-
Re: CommonControls (Replacement of the MS common controls)
Hi,
I’ve got difficulties to print a RichTextBox on a printer.
Code:
Printer.CurrentX = 800
Printer.CurrentY = 800
Printer.Print "x"
RichTextBox1.PrintDoc Printer.hDC, False, , 700, 700, 800, 800
Printer.CurrentX = 900
Printer.CurrentY = 900
Printer.Print "y"
Printer.EndDoc
In this example, I would like to print ‘x’, ‘y’ and RichTextBox1 on the same page, but I always get ‘x’ and RichTextBox1 on one page and ‘y’ on another one.
It is as if RichTextBox1.PrintDoc fires a Printer.EndDoc even if I set CallStartEndDoc to False.
What am I doing wrong ?
-
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
i have encountered some situations where case sensitive entries for Treeview were required, since they contained different data, like registry and Registry having different registry keys. This works well with the microsoft control, but not with the CCR Treeview. I am using the std exe and somehow I managed to get a working case sensitive option in the property page and the control so I am happy for now. I don't know if it could be a useful addition for other people as well.
-
Re: CommonControls (Replacement of the MS common controls)
is it possible to have a toolbar button style to be TbrButtonStyleCheck and TbrButtonStyleDropDown
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Semke
is it possible to have a toolbar button style to be TbrButtonStyleCheck and TbrButtonStyleDropDown
Unfortunately not. BTNS_CHECK and BTNS_DROPDOWN are not combinable.
-
Re: CommonControls (Replacement of the MS common controls)
is it possible to add images to Toolbar ButtonMenus
BTW: Your Project is fantastic I use a a lot, Thank you
-
picbox > ImageList extract to dragIcon causes black square
PROBLEM: I am populating a control's dragIcon from an MSCOMCTL imageList control but the resulting dragIcon is black when I use Krool's imageList. However, it all works fine with the MSCOMCTL imageList control.
https://www.vbforums.com/images/ieimages/2022/05/29.png
BACKGROUND:
The source image is a PNG. The source image is written to a temporary picBox named picDragIcon using the picbox device context using GDI+, specifically, GdipDrawImageRectRectI. To accomplish this, I am using LaVolpe's C32dppDIP method to read PNGs into a VB6 picture control. In this case the picbox is merely a temporary holding control and I want to put that image into a dragIcon.
First step, I use an MSCOMCTL imageList and add the image from the temporary picbox as the sole image in the imageList.
Code:
ImageList1.ListImages.Add , "arse", picDragIcon.Image
I then extract that image from the imageList and set it to be the dragIcon for the target control.
Code:
picRdMap(Index).DragIcon = ImageList1.ListImages("arse").ExtractIcon
As a result, the dragIcon shows perfectly. Why do I use an imageList? If I load the dragIcon directly from the temporary picBox as below:
Code:
picRdMap(Index).DragIcon = picDragIcon.Image ' this only works for .ico types
Then the dragIcon shows nothing, nothing at all. I think it is due to the fact that the temporary image is rendered using GDI+ or only handles .ico types. That is why I use the MSCOMCTL imageList as it somehow seems to convert the GDI+ rendered image on the picBox correctly to something the .dragIcon can use. Some sort of bitmap, anyhow, it does the job.
However, back to my problem. I want to use Krool's version of the imageList control. I prefer to use Krool's imageList as I have so far avoided using any control from MSCOMCTL instead using all of Krool's alternatives.
https://www.vbforums.com/images/ieimages/2022/05/30.png
If I substitute Krool's imagelist the dragicon is a black square. Any ideas? I suspect this is because Krool's control is not expecting a transparent image in a standard picturebox. Any guidance would be useful.
-
Re: CommonControls (Replacement of the MS common controls)
My guess is that Krool's ImageList isn't converting converting the HBITMAP to an HICON properly for this specific image. Have you tried writing your own conversion?
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Niya
My guess is that Krool's ImageList isn't converting converting the HBITMAP to an HICON properly for this specific image. Have you tried writing your own conversion?
I was hoping not to have to, hoping that the Krool version would simply provide the same conversion. I may have to do so though.
For the moment though I will stick with the MSCOMCTL version as it works. We'll just have to see if this is a bug in Krool's own imageList or missing functionality.
-
Re: CommonControls (Replacement of the MS common controls)
-
Re: picbox > ImageList extract to dragIcon causes black square
Quote:
Originally Posted by
yereverluvinuncleber
PROBLEM: I am populating a control's dragIcon from an MSCOMCTL imageList control but the resulting dragIcon is black when I use Krool's imageList. However, it all works fine with the MSCOMCTL imageList control.
https://www.vbforums.com/images/ieimages/2022/05/29.png
BACKGROUND:
The source image is a PNG. The source image is written to a temporary picBox named picDragIcon using the picbox device context using GDI+, specifically, GdipDrawImageRectRectI. To accomplish this, I am using LaVolpe's C32dppDIP method to read PNGs into a VB6 picture control. In this case the picbox is merely a temporary holding control and I want to put that image into a dragIcon.
First step, I use an MSCOMCTL imageList and add the image from the temporary picbox as the sole image in the imageList.
Code:
ImageList1.ListImages.Add , "arse", picDragIcon.Image
I then extract that image from the imageList and set it to be the dragIcon for the target control.
Code:
picRdMap(Index).DragIcon = ImageList1.ListImages("arse").ExtractIcon
As a result, the dragIcon shows perfectly. Why do I use an imageList? If I load the dragIcon directly from the temporary picBox as below:
Code:
picRdMap(Index).DragIcon = picDragIcon.Image ' this only works for .ico types
Then the dragIcon shows nothing, nothing at all. I think it is due to the fact that the temporary image is rendered using GDI+ or only handles .ico types. That is why I use the MSCOMCTL imageList as it somehow seems to convert the GDI+ rendered image on the picBox correctly to something the .dragIcon can use. Some sort of bitmap, anyhow, it does the job.
However, back to my problem. I want to use Krool's version of the imageList control. I prefer to use Krool's imageList as I have so far avoided using any control from MSCOMCTL instead using all of Krool's alternatives.
https://www.vbforums.com/images/ieimages/2022/05/30.png
If I substitute Krool's imagelist the dragicon is a black square. Any ideas? I suspect this is because Krool's control is not expecting a transparent image in a standard picturebox. Any guidance would be useful.
Thanks for the report. I just want to test something.
Instead of
Code:
ImageList1.ListImages.Add , "arse", picDragIcon.Image
can you test following ?
Code:
Set picDragIcon.Picture = picDragIcon.Image
ImageList1.ListImages.Add , "arse", picDragIcon.Picture
If that works (if you confirm) the bugfix in the ImageList would be (in order to get your initial code to work)
Code:
Friend Sub FListImagesAdd(Optional ByVal Index As Long, Optional ByVal Picture As IPictureDisp)
...
Set UserControl.Picture = Picture
Set Picture = UserControl.Picture
Set UserControl.Picture = Nothing
...
-
Re: CommonControls (Replacement of the MS common controls)
Hello, Krool!
I'm trying to work with the richtext control from the replacement of the common controls, latest version.
It seems to be impossible to set the right margin so that it reflects the textwidth of a line, e.g. a right margin of 500 units should lead to a textwidth of 500 units (no left margin set), regardless of the width of the control.
But any positive value of a right margin leads to constant space between the control's right edge and the text, wrapping the text (according to the scrollbars setting).
How do I set a right margin to reflect the textwidth?
Regards, Seniorchef
-
Re: CommonControls (Replacement of the MS common controls)
Krool, your workaround of using set with .picture works. The resulting image is not exactly the same but it will certainly do.
With your control the .dragIcon becomes a white box surrounding the original image, which is different but perfectly acceptable for what I want to do
https://www.vbforums.com/images/ieimages/2022/05/32.png
The MS imageList in comparison creates a dragIcon with a transparent background in BOTH cases. I suppose (as Niya suggests) that the MS version is converting it to an HIcon.
Sorry to give you more work. At least this means I can continue to avoid using MSCOMCTL except for testing.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
yereverluvinuncleber
Krool, your workaround of using set with .picture works. The resulting image is not exactly the same but it will certainly do.
With your control the .dragIcon becomes a white box surrounding the original image, which is different but perfectly acceptable for what I want to do
https://www.vbforums.com/images/ieimages/2022/05/32.png
The MS imageList in comparison creates a dragIcon with a transparent background in BOTH cases. I suppose (as Niya suggests) that the MS version is converting it to an HIcon.
Sorry to give you more work. At least this means I can continue to avoid using MSCOMCTL except for testing.
You could try setting the UseMaskColor to true and set the MaskColor accordingly. (You need to check the exact RGB, probably it's only vbWhite value)
EDIT: gonna update the fix with the UserControl.Picture and Picture object swap. (to allow passing an .Image picture object)
-
Re: CommonControls (Replacement of the MS common controls)
I'll leave it as it is at the moment, setting the mask colour to white does the job of making the dragIcon transparent but it has side effects - other unrelated controls on the form suddenly have their mask turned off revealing the black portions of all their transparencies.
https://www.vbforums.com/images/ieimages/2022/05/33.png
To get around this I tried enabling and disabling the use of the mask just prior to the vbBeginDrag,
ImageList1.UseMaskColor = True
- then disabling it when the vbEndDrag has done its job, it seems that UseMaskColor is not a property that can be easily be enabled at the correct points at runtime.
For the moment the white box is a usable workaround. I'll wait for any bugfix and test for you. No hurry, I have a workaround!
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
yereverluvinuncleber
I'll leave it as it is at the moment, setting the mask colour to white does the job of making the dragIcon transparent but it has side effects - other unrelated controls on the form suddenly have their mask turned off revealing the black portions of all their transparencies.
https://www.vbforums.com/images/ieimages/2022/05/33.png
To get around this I tried enabling and disabling the use of the mask just prior to the vbBeginDrag,
ImageList1.UseMaskColor = True
- then disabling it when the vbEndDrag has done its job, it seems that UseMaskColor is not a property that can be easily be enabled at the correct points at runtime.
For the moment the white box is a usable workaround. I'll wait for any bugfix and test for you. No hurry, I have a workaround!
The fix is released.
You only need the MaskColor "active" during the .Add to the ImageList. So you can turn it on before, add picture to the ImageList, then turn off in the next code line.
Btw, UseMaskColor property is True by default. The MaskColor default is &HC0C0C0.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
The fix is released.
You only need the MaskColor "active" during the .Add to the ImageList. So you can turn it on before, add picture to the ImageList, then turn off in the next code line.
Btw, UseMaskColor property is True by default. The MaskColor default is &HC0C0C0.
understood and thanks!
-
Re: CommonControls (Replacement of the MS common controls)
Okay, here I am again.
My issue about the richtext-control still is unanswered.
No hints, no solutions, no questions?
Anyone out there who uses the richtextbox and margins?
Maybe I'm using the wrong documentation, but what is the right one?
Thank's
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Seniorchef
Okay, here I am again.
My issue about the richtext-control still is unanswered.
No hints, no solutions, no questions?
Anyone out there who uses the richtextbox and margins?
Maybe I'm using the wrong documentation, but what is the right one?
Thank's
I hate this printer margin topic on the richtextbox. It was an issue already several times and I thought now it's properly done.
So, do you have a sample demo which shows the different outcomes between MS richttextbox and VBCCR richtextbox ?
Because as of now I would first suspect a mis-use in your code and not in the routine inside the richtextbox, but I could be wrong of course.
-
Re: CommonControls (Replacement of the MS common controls)
Hello, Krool!
I never mentioned a printer output.
For The sample, you need a form with a MSRichtext-control and a VBCCR-Richtext control with not extra settings.
Code:
Private Sub Form_Load()
With msRtf
.RightMargin = 2500
.Text = "This is a sample text in the richtext control with a right margin on "
End With
With vbRtf
.RightMargin = 2500
.Text = "This is a sample text in the richtext control with a right margin on "
End With
End Sub
Private Sub Form_Resize()
msRtf.Move 30, 30, ScaleWidth, ScaleHeight / 2
vbRtf.Move 30, ScaleHeight / 2 + 30, ScaleWidth, ScaleHeight / 2
vbRtf.Refresh
msRtf.Refresh
End Sub
Drag the window to change the width and you see the difference: the msRichtext keeps the text unchanged while the vbcontrol doesn't. The RightMargin in the MSRtf is independant from the width of the control. That's all.
My App shows text in forms that can be formatted by the user, for which purpose ever. The formatting of paragraphs should stay even after resizing the window.
Regards
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Seniorchef
Hello, Krool!
I never mentioned a printer output.
For The sample, you need a form with a MSRichtext-control and a VBCCR-Richtext control with not extra settings.
Code:
Private Sub Form_Load()
With msRtf
.RightMargin = 2500
.Text = "This is a sample text in the richtext control with a right margin on "
End With
With vbRtf
.RightMargin = 2500
.Text = "This is a sample text in the richtext control with a right margin on "
End With
End Sub
Private Sub Form_Resize()
msRtf.Move 30, 30, ScaleWidth, ScaleHeight / 2
vbRtf.Move 30, ScaleHeight / 2 + 30, ScaleWidth, ScaleHeight / 2
vbRtf.Refresh
msRtf.Refresh
End Sub
Drag the window to change the width and you see the difference: the msRichtext keeps the text unchanged while the vbcontrol doesn't. The RightMargin in the MSRtf is independant from the width of the control. That's all.
My App shows text in forms that can be formatted by the user, for which purpose ever. The formatting of paragraphs should stay even after resizing the window.
Regards
I see your point. I guess that's a behavior change in the underlying richedit library. The msRichTextBox uses richedit v1.0.
-
Re: CommonControls (Replacement of the MS common controls)
Ok - so I guess i will live with it.
Maybe I'll write a workaround in my code.
And again, thank you, Krool.
-
Re: CommonControls (Replacement of the MS common controls)
Hallo Krool,
https://www.vbforums.com/showthread....=1#post5563715
Quote:
The MinDate for DTP is 01-01-1900 and MaxDate is 31-12-9999.
So, this is not possible:
Code:
DTPicker.Value = TimeValue("07:00")
-
VBCCR not work anymore after upgrading to 1.7.38
VB6, Win7x64
I upgraded VBCCR 1.7.37 to VBCCR 1.7.38. and now i get the error message "object library not registered" when i open a VB6 project that is using the ocx.
I get the same error message when i create a complete new project at the VB6-IDE and add the VBCCR17-OCX. I can add the older VBCCR16-OCX or other OCX-files without any errors.
I tried to switch back to VBCCR 1.7.37 but it doesnt help; the error message "object library not registered" still pops up.
I tried to unregister and re-register but nothing helps.
The vb-projects-exe-files compilied with v1.7.37 are running fine with the new VBCCR 1.7.38 OCX!
But i cant open and use any of my vb-projects anymore :sick:
Im lost and need some help...
-
Re: VBCCR not work anymore after upgrading to 1.7.38
i found a solution for the "object library not registered" problem:
Code:
cd C:\Windows\SysWOW64
regtlib msdatsrc.tlb
All vb6-projects using VBCCR17 can be loaded without the error message again!
-
Re: VBCCR not work anymore after upgrading to 1.7.38
Quote:
Originally Posted by
Mith
i found a solution for the "object library not registered" problem:
Code:
cd C:\Windows\SysWOW64
regtlib msdatsrc.tlb
All vb6-projects using VBCCR17 can be loaded without the error message again!
@Krool...
I think you should look into that (since it would break also the "regfree-mode" via manifests)...
IMO, somewhere you're probably exposing a type from msdatsrc.tlb on the OCX'es Public Interface...
Olaf
-
Re: VBCCR not work anymore after upgrading to 1.7.38
Quote:
Originally Posted by
Schmidt
@Krool...
I think you should look into that (since it would break also the "regfree-mode" via manifests)...
IMO, somewhere you're probably exposing a type from msdatsrc.tlb on the OCX'es Public Interface...
Olaf
Thanks for your comment.
I'm not willingly exposing it. I assume it's automagically due to DataBindingBehavior set to 1 - vbSimpleBound on some controls..
-
3 Attachment(s)
Re: CommonControls (Replacement of the MS common controls)
Dear Krool,
Warm Greetings! Happy to be writing to you again, after quite some period of time, and getting the opportunity thus to thank you once again, profoundly, for your monumental efforts.
In this post, I have attached a small project, a test app ("1. Scrollbar issues in Richtextbox.zip") to highlight two issues with scrollbars which I encountered while using the RichTextBox control.
A screenshot of the test app below, just after starting it.
Attachment 185088
A screenshot of the test app below, after clicking the two buttons in it, one after the other.
Attachment 185089
Note-1: Please do read the comments in my code, wherever they appear. Those comments are very important, as far as this 'test app' is concerned.
Note-2: The scrollbars do reappear correctly in rtb1 and rtb2 once I start scrolling the texts in them.
Note-3: In case the scrollbars do appear correctly only, at your end, always, then kindly bear with me and kindly let me know what could be the mistake I am doing at my end which makes the scrollbars disappear or get painted incompletely.
Note-4:
My vb6 IDE is themed. My OS is Windows10, 64-bit. Screen resolution is 1920*1080. Under 'Scale and Layout' in Display settings, it shows '100% (Recommended)'.
Note-5: If the above-explained issues do occur at your end too, but if they are not due to your control, then kindly let me know as to what I should do further. As of now, my own workarounds which I have mentioned (in the test app) do help solve the scrollbar issues in my projects. But then, for each RichTextBox, I need to necessarily have these workarounds.
Note-6: This is the 2nd time ever (and the first time ever, in this thread) that I am posting a project. So, if any mistake on my part in the way I have presented my project, kindly bear with me.
Kind regards.
-
2 Attachment(s)
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
I have been away from programming for a few years and am now back. First thing I look at is your controls and of course download the latest version. I have two computers Win 10 Pro 21H2 and since I am having this problem on only one, I know the problem is at my end. I have try for a few days but no luck so maybe I try asking here.
I am getting this error (screenshot) when I tried to open any of the Forms in the Std-Exe demo. Also has this error when I try to run the demo. Any idea where I should be looking?
Thank you.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
chosk
Hi Krool,
I have been away from programming for a few years and am now back. First thing I look at is your controls and of course download the latest version. I have two computers Win 10 Pro 21H2 and since I am having this problem on only one, I know the problem is at my end. I have try for a few days but no luck so maybe I try asking here.
I am getting this error (screenshot) when I tried to open any of the Forms in the Std-Exe demo. Also has this error when I try to run the demo. Any idea where I should be looking?
Thank you.
Just replace the OLEGuids.tlb with the latest version to your syswow64 folder.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
Just replace the OLEGuids.tlb with the latest version to your syswow64 folder.
Super. This fix it.
Thank you.
-
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
I'm using the ListView in Report-mode with a relatively high icon, which would allow at least 3 lines for the label. However, even when I set LabelWrap to True, the label is displayed on one line, centered in the middle of the icon, and is cut off when it's too long for the available space.
Am I missing something, or is what I'm looking for simply not possible?
Thanks,
Erwin
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Erwin69
Hi Krool,
I'm using the ListView in Report-mode with a relatively high icon, which would allow at least 3 lines for the label. However, even when I set LabelWrap to True, the label is displayed on one line, centered in the middle of the icon, and is cut off when it's too long for the available space.
Am I missing something, or is what I'm looking for simply not possible?
Thanks,
Erwin
No, the ListView is "SingleLine" in report-mode.
The only way is the tile view mode where the sub-items are each separate lines. But it's similar to icon view.. so no report-mode style.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
softv
Dear Krool,
Warm Greetings! Happy to be writing to you again, after quite some period of time, and getting the opportunity thus to thank you once again, profoundly, for your monumental efforts.
In this post, I have attached a
small project, a test app ("1. Scrollbar issues in Richtextbox.zip") to highlight
two issues with scrollbars which I encountered
while using the RichTextBox control.
A screenshot of the test app below, just after starting it.
Attachment 185088
A screenshot of the test app below, after clicking the two buttons in it, one after the other.
Attachment 185089
Note-1: Please do read the comments in my code, wherever they appear. Those comments are very important, as far as this 'test app' is concerned.
Note-2: The scrollbars do reappear correctly in rtb1 and rtb2 once I start scrolling the texts in them.
Note-3: In case the scrollbars do appear correctly only, at your end, always, then kindly bear with me and
kindly let me know what could be the mistake I am doing at my end which makes the scrollbars disappear or get painted incompletely.
Note-4:
My vb6 IDE is themed. My OS is Windows10, 64-bit. Screen resolution is 1920*1080. Under 'Scale and Layout' in Display settings, it shows '100% (Recommended)'.
Note-5: If the above-explained issues do occur at your end too, but
if they are not due to your control, then kindly let me know as to what I should do further. As of now, my own workarounds which I have mentioned (in the test app) do help solve the scrollbar issues in my projects. But then, for each RichTextBox, I need to necessarily have these workarounds.
Note-6:
This is the 2nd time ever (and the first time ever, in this thread) that I am posting a project. So, if any mistake on my part in the way I have presented my project, kindly bear with me.
Kind regards.
Any solution/suggestions, for the above two issues, Krool?
Just a gentle reminder only, Krool. Otherwise, I do understand your time constraints.
Kind Regards.
-
Re: CommonControls (Replacement of the MS common controls)
softv, thranks for bringing this up again.
Should be fixed now.
-
Re: CommonControls (Replacement of the MS common controls)
Hello!
As a late reply to my post #3393 (right margin in richtext) I want to share my solution for that issue with the forum.
As mentioned earlier, the right margin in the microsoft control behaves different from the right margin in the replacement control.
Here is my solution
Code:
nHdc = CreateDC("Display", "", 0, 0)
SendMessage hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - LeftMargin
DeleteDC nHdc
Maybe the lines can be placed in then source of the control; I put them in my advanced usercontrol in my RightMargin Property.
Krool, if this was your intention when you mentioned the printer margin output - I got you wrong, sorry.
Anyway, I now can take full advantage of the improved control in my app.
Thanks and bye for now
-
Re: CommonControls (Replacement of the MS common controls)
Hi Krool and thanks for your project!
I have developed for year an editing program for decoder channel list and used listview to show all data like channel, transponder, etc, i've implemented a OLE drag and drop for all listview to order manually the items and it works without no problem, setting OLEDragMode as vbOLEDragAutomatic and OLEDropMode as vbOLEDropManual. Event OLEDragDrop are raised and in OLEDragOver I can select the item over the mouse cursor. A strange problem appear when I substituted the ListView with your, version 1.7.37, using ocx control for IDE on Win 10 64. When i drag an item over the same control the cursor change do deny, Effect in OLEDragOver remain at 0 and the event OLEDragDrop are not raised, but this appens only when the property View is List or Report. I've tried to change the setting in controls demo in all mode possible but the problems remain, the correct behaviour happens only when drag an item from another control. In ListBox and TreeView instead all works properly. It's not possible with ListView to dragdrop an item in the same control when is in list or report mode? I hope that is a simple problem to solve and wait for your replay.
Thank you.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Krool
softv, thranks for bringing this up again.
Should be fixed now.
Thanks a LOT, as always, for the update, dear Krool.
Kind Regards.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
cecelife
I have developed for year an editing program for decoder channel list and used listview to show all data like channel, transponder, etc, i've implemented a OLE drag and drop for all listview to order manually the items and it works without no problem, setting OLEDragMode as vbOLEDragAutomatic and OLEDropMode as vbOLEDropManual. Event OLEDragDrop are raised and in OLEDragOver I can select the item over the mouse cursor. A strange problem appear when I substituted the ListView with your, version 1.7.37, using ocx control for IDE on Win 10 64. When i drag an item over the same control the cursor change do deny, Effect in OLEDragOver remain at 0 and the event OLEDragDrop are not raised, but this appens only when the property View is List or Report. I've tried to change the setting in controls demo in all mode possible but the problems remain, the correct behaviour happens only when drag an item from another control. In ListBox and TreeView instead all works properly. It's not possible with ListView to dragdrop an item in the same control when is in list or report mode? I hope that is a simple problem to solve and wait for your replay.
Thanks. Should be fixed now.
Quote:
Originally Posted by
Seniorchef
Hello!
As a late reply to my post #3393 (right margin in richtext) I want to share my solution for that issue with the forum.
As mentioned earlier, the right margin in the microsoft control behaves different from the right margin in the replacement control.
Here is my solution
Code:
nHdc = CreateDC("Display", "", 0, 0)
SendMessage hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - LeftMargin
DeleteDC nHdc
Maybe the lines can be placed in then source of the control; I put them in my advanced usercontrol in my RightMargin Property.
Krool, if this was your intention when you mentioned the printer margin output - I got you wrong, sorry.
Ok, but EM_SETTARGETDEVICE should'nt be for margins at all. Why are you passing the margin at lParam ? It's suppossed to be a line width...
-
Re: CommonControls (Replacement of the MS common controls)
So that's what I understood from MS's documentation here https://docs.microsoft.com/en-us/win...ettargetdevice. The linewidth is the width between left and right margin. When the left margion is 0 that makes the right margin the linewidth.
The code in my snippet sets the linewidth and all text in the control is wrapped at that mark, like in the MS control in my sample.
Greetings
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Seniorchef
So that's what I understood from MS's documentation here
https://docs.microsoft.com/en-us/win...ettargetdevice. The linewidth is the width between left and right margin. When the left margion is 0 that makes the right margin the linewidth.
The code in my snippet sets the linewidth and all text in the control is wrapped at that mark, like in the MS control in my sample.
Greetings
You seem right. The MS RichTextBox doesn't use EM_SETMARGINS, it only uses EM_SETTARGETDEVICE.
So, how shall we proceed?
My proposal would be to keep using EM_SETMARGINS and just call EM_SETTARGETDEVICE and each change of either left or right margin property.
The LineWidth is correctly the RightMargin minus LeftMargin (in Twips always)
Also
Code:
CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)
seems to be the correct usage. So it also works on multiple monitors.
EDIT: If RightMargin minus LeftMargin results in 0 then the wParam (hDC) is also 0.
EDIT2: The MS RichTextBox doesn't have a LeftMargin. (only RightMargin) so a negative LineWidth never applies. Can you test if a negative LineWidth works ? E.g. RightMargin set to 0 and LeftMargin set to something menaingful.
Thanks
-
Re: CommonControls (Replacement of the MS common controls)
I'm busy this morning, but give a sample later this day...
My line with createDC() works on my PC with five monitors, but nevertheless yours works too. Depends prob. on the declaration (which I forgot to copy).
Greetings
-
Re: CommonControls (Replacement of the MS common controls)
Here some information:
It's true, the MS control has no left margin; this is one reason why I prefer your control.
A negative LineWidth is same like a LineWidth of 0 which cancels the WYSIWYG and makes the text wrap to the right window border.
Code:
'Create a new project
'Add a form
'Add the VBCCR17.OCX
'Paste this code to the form
Option Explicit
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As Long, ByVal lpInitData As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Const WM_USER = &H400
Const EM_SETTARGETDEVICE = (WM_USER + 72)
Dim mnRightMargin&
Private Sub Form_Load()
appLeftMargin = 500 'twips
appRightMargin = 5000 'twips
'Paste text from the clipboard to the control to make the margins usefull...
'Resize the form to see the behavior of the control and the margins
End Sub
Private Sub Form_Resize()
If ScaleHeight > 60 And ScaleWidth > 60 Then
rtf.Move 30, 30, ScaleWidth - 60, ScaleHeight - 60
End If
End Sub
Property Let appLeftMargin(ByVal nNewValue As Long)
On Error Resume Next
Dim nHdc&
'anything to do...
If rtf.LeftMargin <> nNewValue Then
'set VBCCR-control new LeftValue
rtf.LeftMargin = nNewValue
'check rightmargin...
If mnRightMargin > nNewValue Then
nHdc = CreateDC("Display", "", 0&, 0&)
'set the linewidth according the margins, make WYSIWYG
SendMessage rtf.hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - nNewValue
'clean up
DeleteDC nHdc
End If
End If
End Property
Property Let appRightMargin(ByVal nNewValue As Long)
Dim nHdc As Long
Dim nLeftMargin&
'anything to do...
If nNewValue <> mnRightMargin Then
nLeftMargin = rtf.LeftMargin
'illegal RightMargin set to 0
'take the WYSIWYG from Control...
Select Case nNewValue
Case Is <= nLeftMargin
'cache RightMargin
mnRightMargin = 0
'reset the controls rightmargin property ...
rtf.RightMargin = 0
'make the VBCCR-Control wrap to window
SendMessage rtf.hwnd, EM_SETTARGETDEVICE, 0&, 0&
'set RightMargin
Case Else
'cache RightMargin
mnRightMargin = nNewValue
'make control WYSIWYG
nHdc = CreateDC("Display", "", 0&, 0&)
'set the linewidth according the margins, make WYSIWYG
SendMessage rtf.hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - nLeftMargin
'clean up
DeleteDC nHdc
End Select
End If
End Property
So in my opinion leave the handling of the margins as they are. The handling of the LineWidth should be done by the calling app, even more because there is no right and left margin stored in a richtext. It should be up to the app to set and handle them.
Greetings
-
Re: CommonControls (Replacement of the MS common controls)
Thinking about it, there could be a more elegant solution:
A RightMargin greater than the LeftMargin sets the LineWidth to RightMargin minus LeftMargin.
A RightMargin of zero or negative (or smaller than LeftMargin) sets the RightMargin to that (positive) value and cancels the LineWidth.
This is more or less the essence of my sample above but it also breaks the compatibility of the RightMargin Property, because negative values are legit.
Code:
LeftMargin=0: RightMargin=-100 'RightMargin=100 twips from the right border of the control
LeftMargin=0: RightMargin=5000 'LineWidth=5000 twips
LefMargin=100: RightMargin=2400 'LineWidth=2300 twips
LeftMargin=500: RightMargin=75 'LineWidth=0, RightMargin=75 twips from right border
Greetings
-
Re: CommonControls (Replacement of the MS common controls)
I also implemented the event RulerScroll to my code. The Event is used to move a ruler according to the position of the scrollbars of the control. I'm using the "VBAccelerator Subclassing adn Timer Assistent" for subclassing, so the snippets are
Code:
'start Subclassing
SSubTimer6.AttachMessage Me, rtf.hWndUserControl, WM_COMMAND
and in the queue
Code:
Dim ScrollPos As POINTAPI
Dim X&, Y&
'Subclassing ...
If iMsg = WM_COMMAND Then
'
Select Case Int(wParam \ &H10000)
Case EN_UPDATE
SendMessage rtf.hwnd, EM_GETSCROLLPOS, 0, ScrollPos
X = (ScrollPos.X * Screen.TwipsPerPixelX)
Y = (ScrollPos.Y * Screen.TwipsPerPixelY)
RaiseEvent RulerScroll(X, Y)
...
The name of the event "RulerScroll" is arbitrary. I use it to scroll a ruler above the text to show the caret's position and for tabs and borders.
Greetings
-
1 Attachment(s)
Re: CommonControls (Replacement of the MS common controls)
Hello Krool, I found an issue when an UserControl that is ControlContainer is holding a LabelW inside.
The OleDropMode can't be changed to manual, it raises an error.
Attached is a test project.
-
Re: CommonControls (Replacement of the MS common controls)
Quote:
Originally Posted by
Eduardo-
Hello Krool, I found an issue when an UserControl that is ControlContainer is holding a LabelW inside.
The OleDropMode can't be changed to manual, it raises an error.
Attached is a test project.
That's a VB6 bug. See below workaround I use for FrameW:
Code:
Public Property Get OLEDropMode() As OLEDropModeConstants
Attribute OLEDropMode.VB_Description = "Returns/Sets whether this object can act as an OLE drop target."
OLEDropMode = UserControl.OLEDropMode
End Property
Public Property Let OLEDropMode(ByVal Value As OLEDropModeConstants)
' Setting OLEDropMode to OLEDropModeManual will fail when windowless controls are contained in the user control.
Const DRAGDROP_E_ALREADYREGISTERED As Long = &H80040101
Select Case Value
Case OLEDropModeNone, OLEDropModeManual
On Error Resume Next
UserControl.OLEDropMode = Value
If Err.Number = DRAGDROP_E_ALREADYREGISTERED Then
RevokeDragDrop UserControl.hWnd
UserControl.OLEDropMode = Value
End If
On Error GoTo 0
Case Else
Err.Raise 380
End Select
UserControl.PropertyChanged "OLEDropMode"
End Property
-
Re: CommonControls (Replacement of the MS common controls)
-
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
I noticed an area my having slowed down significantly after implementing the CCR statusbar. I investigated this by simply updating two panels 10.000 times to an empty string.
Code:
brStatusBar.Panels(2).Text = ""
brStatusBar.Panels(3).Text = ""
Using the original statusbar this took 32 milliseconds. Using the CCR statusbar it took 2505 seconds!
Is this simply the result / consequence of Unicode support, or am I doing something wrong?
Regards,
Erwin