Re: CommonControls (Replacement of the MS common controls)
Originally Posted by jpskiller
RichTextBox Help
I know that this auto detects URLS but so far I cant find a way to actual open the url with default app ie Browser / Email etc.
I have tried a couple of suggestions from around but there based on original and dont seem to work.
I presume since it auto detects i must be relatively simple to run it!
I can live with mine crashing (cant explain why) I just use normal form nstead of Child MDI, but does anyone have any idea on how to do this part with this RichTextBox Control, cheers
Re: CommonControls (Replacement of the MS common controls)
I have re uploaded the test file I made and added all the files used for the demo in the root folder and reference them from there, still have same issue if use a MDI child form with a richtextbox, if close that form or the MDI form it just crashes out
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by jpskiller
I have re uploaded the test file I made and added all the files used for the demo in the root folder and reference them from there, still have same issue if use a MDI child form with a richtextbox, if close that form or the MDI form it just crashes out
OS:Windows 10
It doesn't crash in here.
Not in the IDE, not as EXE.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Karl77
(Pager question)
If you have a good idea, then that would be nice.
For now the workaround is a picturebox to cover the area with the unwanted color.
I traced the problem. If an buddy control is in place the pager control takes the background color of the buddy.
For instance when using the ToolBar control. The child window which the pager control sets is the hWnd of the UserControl and not the ToolBar API window.
And my ToolBar control does not set the BackColor of the UserControl at run-time. Which could be changed of course to solve the issue for the ToolBar.
On which buddy control do you face the issue? ToolBar? Any other?
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
I traced the problem. If an buddy control is in place the pager control takes the background color of the buddy.
For instance when using the ToolBar control. The child window which the pager control sets is the hWnd of the UserControl and not the ToolBar API window.
And my ToolBar control does not set the BackColor of the UserControl at run-time. Which could be changed of course to solve the issue for the ToolBar.
On which buddy control do you face the issue? ToolBar? Any other?
Yes, I do use it for the awesome toolbars.
I didn't try it with other controls yet.
If you could make the pager working with the toolbars (regarding the color), that would be great.
Thank you.
Re: CommonControls (Replacement of the MS common controls)
Well guys, tested the MDI compiled app on different PC and as you said it works fine, but on this laptop in the IDE and compiled it still crashes out bizarre, but getting back to my original problem is there a way to respond to clinks on the links that are highlighted to open web page / email etc.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by jpskiller
Well guys, tested the MDI compiled app on different PC and as you said it works fine, but on this laptop in the IDE and compiled it still crashes out bizarre, but getting back to my original problem is there a way to respond to clinks on the links that are highlighted to open web page / email etc.
You need to handle the 'LinkEvent' event in the RichTextBox control.
Code:
Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
End Sub
Watch there for a WM_LBUTTONDOWN message for instance and then open your web page / email. (manually by your own code)
The params LinkStart and LinkEnd helps to trace the actual link that was clicked.
Originally Posted by Karl77
Statusbar Alignment
Set the Windows size dialog to this:
I know it is mean to set this value, but other work as well to show the effect (except 125, 150%).
On a new form, place the Krool StatusBar control.
Set alignment to bottom.
No code needed in the form.
Start the form.
See this:
Now I tested with the CC5 statusbar.
Same picture.
Perhaps the replacement statusbar should be better?
Indeed by an DPI of 113% the ScaleWidth and ScaleHeight values are bugged in VB6.
This whole DPI story is still an open issue. (with exotic DPI values or very large, e.g. 200%)
Re: CommonControls (Replacement of the MS common controls)
cheers that's great
I have tried this as a presumed link end was the length of the string!
Private Const WM_LBUTTONDOWN As Long = &H201
Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
Dim txt As String
txt = Mid$(RichTextBox1.Text, LinkStart, LinkEnd)
Select Case wMsg
Case WM_LBUTTONDOWN
' ShellExecute Me.hwnd, "Open", txt, vbNullString, "C:\", SW_SHOWNORMAL
End Select
End Sub
It does capture where the link clicked start is but linkend can be any thing from 5 - 20 extra chars, so I guess thats not how you use it, help appreciated
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by jpskiller
I have tried this as a presumed link end was the length of the string!
Private Const WM_LBUTTONDOWN As Long = &H201
Private Sub RichTextBox1_LinkEvent(ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long, ByVal LinkStart As Long, ByVal LinkEnd As Long)
Dim txt As String
txt = Mid$(RichTextBox1.Text, LinkStart, LinkEnd)
Select Case wMsg
Case WM_LBUTTONDOWN
' ShellExecute Me.hwnd, "Open", txt, vbNullString, "C:\", SW_SHOWNORMAL
End Select
End Sub
It does capture where the link clicked start is but linkend can be any thing from 5 - 20 extra chars, so I guess thats not how you use it, help appreciated
There is an error in your code, in the Mid$ function.
Thanks I have corrected my code to match and moved it into Case WM_LBUTTONDOWN, but still have an issue,could this be my laptop again
I have a link http://www.google.co.uk - this is highlighted in the rt box, but the above mid$ returns http://www.google.co
I have another link which is over 30 chars, that is returned with only the last 2 chars missing
And even stranger the shell command does not appear to run, and I am using the same shell command in other places and works fine even if the links incorrect!
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by LaVolpe
ScaleWidth,ScaleHeight cannot be trusted. It can be less than what the host reports. If UC is designed with a width of 200 pixels, 3000 twips, in 96 DPI and shown in 200% DPI, then at 200% DPI, you would expect the host to report the UC as 400 pixels, twice as large at twice the original DPI. But not so. The host still reports the UC as 3000 twips as expected, but the size in pixels would be 3000 / 7 = 428.571. If your UC's scalemode were pixels, you'd expect its ScaleWidth to report 428.571. However, the UC's scalewidth in twips is 2800 and in pixels: 400, 28.571 pixels smaller than the host.The difference in VB and System twips per pixel can be used to show that difference: 3000 * 7 / 7.5 = 2800
I just want to reassure something concerning this. Because I am preparing the DPI aware fixes for this project.
Can it be that ScaleWidth,ScaleHeight can be correctly?
Because for example in my StatusBar control.
I need to make some of the tweaks there so the control is sized correctly. (use of Extender.Move instead of UserControl.Size and the use of Extender.Move in the UserControl_Resize event) But in my CommandButtonW control it seems that there is no change actually necessary. There is only MoveWindow with ScaleWidth,ScaleHeight in the UserControl_Resize event and it looks that the ScaleWidth,ScaleHeight are correctly.
The other differences are only that the StatusBar does some internal resizing and is alignable.
Re: CommonControls (Replacement of the MS common controls)
Remember that this issue arises only when the DPI that VB is using is not the same as the operating system is reporting. Using 200% DPI for example, the system will report 192 DPI (96 * 200%). At 192 DPI, twips per pixel will be 7.5 (1440/192). However, VB reports 7 twips per pixel which indicates a different internal DPI: 1440 / 7 = 205.7143 DPI or 214.29%. The following calculation will determine whether DPIs are different:
Code:
If 1440! \ Screen.TwipsPerPixelX < 1440! / Screen.TwipsPerPixelX Then ' non-system DPI in use
You can get ScaleWidth,ScaleHeight to sync up with the size the host is reporting by resizing from within the control via its Extender object. You may have to resize via the Extender each time the control is resized, i.e., when control is first loaded, whenever user resizes it from the host, and whenever you resize it from within the control, like AutoSizing.
Last edited by LaVolpe; Feb 28th, 2016 at 09:59 AM.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
thanks that's great much appreciated
txt = Mid$(Replace$(RichTextBox1.Text, vbLf, vbNullString), LinkStart + 1, LinkEnd - LinkStart) - this works fine, the other seemed to give other text from page
maybe for future development have option to return the link clicked on or even just auto open it depending if option ON/OFF, and include other types ie. auto detect email address
Re: CommonControls (Replacement of the MS common controls)
CommandButtonW
Q1:
Code:
cmd_Test.Picture = imgl.ListImages(1).ExtractIcon
cmd_Test.Caption = "This is a test button"
Vista:
XP:
This works well under Vista+, but under XP the caption is not there.
The caption is only there if I assign an imagelist to the button - not very wanted.
Seems like a small glitch to me.
Q2:
Code:
cmd_Test.ToolTipText = "This is the button's tooltip" & vbLf & "cmd_Test"
For the toolbar buttons, the vbLF produces a nice multiline tooltip.
Not so for other controls like the CommandButtonW.
While I can easily live with it, perhaps it is not a big deal to get this working?
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Karl77
CommandButtonW
Q1:
Code:
cmd_Test.Picture = imgl.ListImages(1).ExtractIcon
cmd_Test.Caption = "This is a test button"
Vista:
XP:
This works well under Vista+, but under XP the caption is not there.
The caption is only there if I assign an imagelist to the button - not very wanted.
Seems like a small glitch to me.
Q2:
Code:
cmd_Test.ToolTipText = "This is the button's tooltip" & vbLf & "cmd_Test"
For the toolbar buttons, the vbLF produces a nice multiline tooltip.
Not so for other controls like the CommandButtonW.
While I can easily live with it, perhaps it is not a big deal to get this working?
This is not a glitch with the CommandButtonW. The PictureAndCaption property is only supported on comctl32.dll version 6.1 or higher. (means Vista+)
For the ToolTip. That's normal. As for the ToolBar there is a API tooltip included by the control itself. (Button class collection)
And the CommandButtonW uses the intrinsic VB UserControl ToolTip function. And this is not multiline. Solution: Let it empty and use a ToolTip class object for the CommandButtonW. (there are plenty of such class objects available on the net)
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
This is not a glitch with the CommandButtonW. The PictureAndCaption property is only supported on comctl32.dll version 6.1 or higher. (means Vista+)
Ok, I see.
But then, why does it work with an assigned imagelist?
I don't get it.
EDIT:
I can fill an imagelist on the fly and assign it to the button.
Then XP compatibility is done.
Q:
Can I create a Krool imaglist by code only?
Dim IL as new Projectname.imagelist doesn't work.
For the ToolTip. That's normal. As for the ToolBar there is a API tooltip included by the control itself. (Button class collection)
And the CommandButtonW uses the intrinsic VB UserControl ToolTip function. And this is not multiline. Solution: Let it empty and use a ToolTip class object for the CommandButtonW. (there are plenty of such class objects available on the net)
Also understood.
I thought it could be just an oversight.
Re: CommonControls (Replacement of the MS common controls)
Important update released for vertical ToolBar control. (Align property set to vbAlignLeft or vbAlignRight)
The Vertical ToolBar behaves now like the original MS control when the Wrappable property is set to False.
Also changing from horizontal to vertical and vice versa after initialization works now properly.
Originally Posted by Karl77
Can I create a Krool imaglist by code only?
Dim IL as new Projectname.imagelist doesn't work.
No, you can't.
But what is the problem to place a ImageList control onto the Form? The CommandButtonW must be anyway placed on a Form.
So the ImageList can be just next to it.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
But what is the problem to place a ImageList control onto the Form? The CommandButtonW must be anyway placed on a Form.
So the ImageList can be just next to it.
No problem at all, I just want to place as less controls a possible on a form.
The extra imagelist is not the only one...
I think I have found an elegant solution for this "non-problem".
Re: CommonControls (Replacement of the MS common controls)
I'm not a UserControl person but use the following which converts between the scales used in standard user controls and those used by vb, it's working pretty well.
Assumes Screen.TwipsPerPixelX and Screen.TwipsPerPixelY will be equal.
Maybe it'll give you some ideas...
Code:
Public Function DpiCorrectionFact() As Single
'Useful to Size OCX Controls (eg. SSTab etc.) and to size other controls relative to them
' returns ratio between vb6 TwipsPerPixel/ Windows TwipsPerPixel; a number >0 <=1
'Returns exactly 1 at the dpi 'sweet spots' of 96, 120, 144, 160, 180, 240 dpi etc
' when no corrections are required.
DpiCorrectionFact = Screen.TwipsPerPixelX / (96 / GetWindowsDPI(0) * 15)
End Function