Thanks.
2505 seconds or milliseconds ?
Printable View
@Erwin69,
Do you set 10000 times the exact same text ?
Because setting each time a different text the performance of the MS StatusBar is as bad as well. However, if old and new text is equal I can of course make an improvement, if necessary.
Because changing a text the refresh is "immediately". So in below example you can look how it increments. I did the "same" in VBCCR.
Code:Dim T As Single
T = Timer
Dim i As Long
For i = 1 To 10000
StatusBar1.Panels(1).Text = "test" & i
Next i
Debug.Print Timer - T
Hi Krool,
I notice the slowness with different values as well. I was indeed assigning the same value many times.
As background info: in this particular case, I'm updating the statusbar as part of the mouse move, so that the user knows which object the cursor is over. For that the code cycles through several collections, some of which can have over 1000 items, and evaluates the coordinates of the item vs the mouse position. If the item being evaluated is not under the cursor, I set the two panels to "", so assigning the same value many times.
I've now fixed it by first checking the value of one panel, and only updating it when it's not "".
Regards,
Erwin
Erwin69, you should only assign a value when it has changed, meaning when it is different from the value already in the panel.
Greetings
Seniorchef
Well, that's what I described in my previous post as the fix. Point is that with the standard status bar there was no delay when assigning the same value that the panel already had. Maybe MS optimized that by only refreshing the control if the value has changed. I thought it wise to share this info with Krool and the community.
ProgressBar/StatusBar problems
A MDI form has a StatusBar.
On the first panel it shall show a ProgressBar on demand.
After progress is finished, the ProgressBar shall hide.
a)
ProgressBar.Visible has no effect.
b)
The StatusBar font size can't be changed.
---
Not sure it is a VBCCR problem.
But perhaps in VBCCR there are other means to solve the 2 'problems'?
Code:VERSION 5.00
Object = "{7020C36F-09FC-41FE-B822-CDE6FBB321EB}#1.2#0"; "VBCCR17.OCX"
Begin VB.MDIForm MDIForm1
BackColor = &H8000000C&
Caption = "MDIForm1"
ClientHeight = 3975
ClientLeft = 120
ClientTop = 465
ClientWidth = 7740
LinkTopic = "MDIForm1"
StartUpPosition = 2 'CenterScreen
Begin VBCCR17.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
Top = 3480
Width = 7740
_ExtentX = 13653
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Segoe UI"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
AllowSizeGrip = 0 'False
InitPanels = "MDIForm1.frx":0000
End
Begin VB.PictureBox Picture1
Align = 1 'Align Top
BeginProperty Font
Name = "Segoe UI"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 0
ScaleHeight = 1035
ScaleWidth = 7680
TabIndex = 0
TabStop = 0 'False
Top = 0
Visible = 0 'False
Width = 7740
Begin VBCCR17.ProgressBar ProgressBar1
Height = 615
Left = 240
Top = 120
Visible = 0 'False
Width = 3780
_ExtentX = 6668
_ExtentY = 1085
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Segoe UI"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Step = 10
End
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1
Left = 840
Top = 1440
End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetParent _
Lib "user32" (ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Sub MDIForm_Click()
ProgressBar1.Visible = True
Timer1.Enabled = True
With ProgressBar1
Call SetParent(.hWnd, StatusBar1.hWnd)
.Left = 1000 'not working
.Top = 0
.Width = StatusBar1.Width
.Height = StatusBar1.Height / 2
End With
End Sub
Private Sub Timer1_Timer()
With ProgressBar1
.Value = .Value + 1
If .Value >= 100 Then
Timer1.Enabled = False
.Value = 0
.Visible = False 'not working
'workaround
.Width = 0
.Height = 0
End If
End With
End Sub
I can change the font but not the font size.
Try to set Segoe UI / 10.
Reverts to 8.25.
Could this have to do with the various sizes that have been installed for the font on the PC? I remember having had some challenges with font sizes in the past with Windows seemingly arbitrarily switching to another size than the number it was given.
Also, as you’re talking about a UI font, could Windows’ scaling setting play a role, e.g. if it’s not 100%?
Now I have 9.75 as well after several tries.Quote:
I can't replicate. For me it just reverts to 9.75
I had to set a different font before, change the size, and then set the font.
So forget the strange effect.
Not in this case.Quote:
Also, as you’re talking about a UI font, could Windows’ scaling setting play a role, e.g. if it’s not 100%?
I work at 100% always, and alter the setting for tests only.
I never save a project when not at 100%.
Toolbar index problem
I have a toolbar with 3 buttons.
They are added by code, using the string key of the imagelist.
All fine.
Now I have a .DisabledImagelist.
For this test the imagelist holds the same images, but in different order.
While the single image has the same key as in the normal imagelist.
When I now disable a button by key, the wrong image from the DisabledImagelist is applied.
It would be good if the image for the disabled button is fetched by the image key.
Attachment 185607
I understand.. However, the "solution" is not easy.
First of all, the TBBUTTONINFOW structure has only single iImage member.
So TB_SETIMAGELIST/TB_SETDISABLEDIMAGELIST/TB_SETHOTIMAGELIST do use the same iImage member.
That could be solved applying I_IMAGECALLBACK on iImage member and set the appropriate index at TBN_GETDISPINFO. But, that implies two possible solutions:
1. Fetch the index from the ImageList at every TBN_GETDISPINFO. (performance penalty)
2. Add new DisabledImage/HotImage in the TbrButton class. So that the index can be fetched once and used at TBN_GETDISPINFO. For back-compat reasons DisabledImage/HotImage must return the Image property in case they are not set. (empty) Which would be possible as the properties are Variants.
So I opt for solution 2. In would be possible even to incorporate this into VBCCR17 (only typelib version increments)
But that would require your code to set the possible new DisabledImage property afterwards. (an enhancement in the Buttons.Add signature is not possible as it breaks binary compatibility)
example:
What do you think ?Code:With .Buttons.Add(, "key1", , TbrButtonStyleDefault, "a")
.DisabledImage = "a"
End With
Performance penalty is not my friend.
On the other hand, it depends on how often it happens and how long it takes.
Other idea:
Sorting the .DisabledImageList so that the index matches the .ImageList.
This has to be done 1x only.
(Don't know how to handle it when the DisabledImageList is shorter than .ImageList.)
A change in the source is no problem.
When using such, is the image from the .DisabledImageList?Code:.DisabledImage = "a"
If so, then fine.
Regarding the imagelists:
Up to now I create the disabled images manually.
I don't do it for all normal pictures.
And I don't want do do that at all anymore.
The normal pictures get added to the imagelist by code.
The sources are PNGs with transparency in a ressource file.
Works good, no problem.
The idea is now, to read the pictures in the imagelist, make them brighter and greyscale and copy the result to a .DisabledImagelist.
Would avoid the former issue "Toolbar index problem" completely.
Before I reinvent the wheel:
Are there any functions I could use for the image processing in VBCCR?
Or another idea which is not a large additional library?
Here:
Attachment 185631
Yes the MSCOMCTL.OCX behavior is the same for the ToolBar.
So, yes. I keep everything like it is. Adding a "DisabledImage", "HotImage" property in a Button object would complicate everything and might be confusion due to the back-compat thing of the "fallback" to "Image" property.
2 RICHTEXTBOX PROBLEMS
1)
VBCCR17 OCX and EXE:
Make a new project and place a RichTextBox1 on the form.
RightToLeftMode = 0
RightToLeft = True
Run.
In here the whole RichTextBox1 renders black.
2)
I use an older version of the VBCCR RichTextBox.
The black background issue is not in it.
Question:
What should I do to add some spaces to the text?
When I put them after the \cf4, they do not appear.
Surprisingly the spaces are found before the text 'Boing'.
Other characters like . do work and appear at the end.
For now I begin with the spaces - they appear at the end (m1 in the example).
Not a good 'fix'.
Code:Dim m As String
Dim m1 As String
Dim m2 As String
Dim SomeSpaces As String
SomeSpaces = " " '5 spaces
'spaces are after the text
m1 = "{\rtf1 " & _
"{\colortbl ;\red227\green38\blue33;\red0\green128\blue0;\red51\green51\blue204;\red0\green0\blue0;}" & _
"\cf1" & _
SomeSpaces & _
"Boing \cf2Bum \cf3Tschak\cf4 "
'spaces are before the text
m2 = "{\rtf1 " & _
"{\colortbl ;\red227\green38\blue33;\red0\green128\blue0;\red51\green51\blue204;\red0\green0\blue0;}" & _
"\cf1Boing \cf2Bum \cf3Tschak \cf4 " & _
SomeSpaces
m = m1 'or m2
RichTextBox1.TextRTF = m
I can't compare with Richtx32.ocx, it doesn't have RTL.
Just a head's up. The demo for this project still doesn't run (as I reported in 2017). The .tbl files are included in a sub folder but they aren't registered so the reference to them fails and the demo dies at that point. If there was a readme included that explained how to register a TBL file, it could go a long way towards fixing this. Sadly, if the demo doesn't run, most people will quickly bail. Which is a real shame. This is an incredible project and it deserves to be seen and shared and used. But as I say... with a non-functional demo, it will be only used by a handful of people who can get it working.
That said, you can download the compiled OCX from a different thread. Most people should know how to register an OCX even without a readme and it works fine. Thanks for sharing this project and all the hard work that has gone into it.
I have no problem getting the demo project to run.
TLB files (assuming that's what you mean) get registered when you add them or open a project referencing them. You might run into trouble if you have a previous version registered and the path no longer exists. In that case the new version wouldn't register. You'd have to use the old path for the tlb, or recreate it (new version is fine), unregister, then delete it and open with the new path.
Tried in the EXE project and OCX.
Blackness bug is gone.
Simplified example:Quote:
The other question with the \cf4 I don't get..
Set a RichTextBox to RTL.
See the right aligned words in the RichTextBox.Code:RichTextBox1.TextRTF = "{\rtf1Boing Bum Tschak" & " "
The spaces should come after Tschak.
But the spaces are before Boing.
You can see this easily when you CTRL+A the RichTextBox content.
Now try
The spaces are after Tschak.Code:RichTextBox1.TextRTF = "{\rtf1" & " " & "Boing Bum Tschak"
Attachment 185711
---
What are the spaces for?
I want a label with right aligned colored text, RichTextBox should do it.
At the right I want a little offset from the edge.
A single space char would be enough.
Glad it works for you. It definitely doesn't work for me. I'm using a brand new laptop and it has no tlb files (that I know of) so I don't think it's an old version issue. If anything, it's probably the opposite - it may be that you had an old version installed which allowed you to get the demo to work.
I don't think most people work with tlb files or would even know what they were or how to register one or delete one. I know I don't and I've been using VB since VB 1.0 for DOS was released.
It's a shame this information isn't included with the demo. That was the point of my post.
You don't need to register them yourself, if you tried, that's probably where the problem arose.
Krool has updated the tlb in compatibility-breaking ways several times without changing the GUID (as have I with oleexp, so not complaining), so when I've upgraded, I've had to do some manual un registration to use the new version. But I also just built a new system this year so everything was new again; it ran fine.
TLBs (most of them, like OLEGuids and oleexp) are 100x easier to deal with registration wise than ocx, those are a consistent nightmare.
hi krool
I'm using your textboxes to display data in Arabic from database and they are doing very well.
However when adding data at runtime :
eg TextBoxW1.Text = "اللغة العربية" they are showing strange characters.
as opposed to VB textboxes which are showing data correctly at runtime but strange symbols from database.
eg Text1.Text = "اللغة العربية"
thanks
Toolbar problem with .DisabledImagelist
When a button is set to enabled = false by code the button shows the correct image.
This does not work when the button is TbrButtonStyleCheck + .Value = TbrButtonValuePressed.
See attached sample to play with:
Attachment 185784
EDIT:
MSCOMTL's toolbar shows the same behavior as in VBCCR17.
On Enabled = false for a button, the button style has to be default.
Otherwise the image from the .DisabledImagelist is not used.
Before setting Enabled = false, style and value must be stored for Enabled = true.
I wrote a helper function that stores the style and state of a button before appling the image.
It uses the button Tag to store the values.
This kind of works ok, but the Tag property is lost for other uses.
Ok, I could use a companion list instead of the Tag.
Bad is that this list has to be refreshed on every ButtonClick.
---
The problem is solved so far, but it is a cumbersome approach.
My wish is that VBCCR17's toolbar button uses the .DisabledImageList independent from the state and style of the button.
Something to play with:
Attachment 185824
Hi Krool,
I'm new here. Here can I download the latest version of your CommonControls replacement?
Thank you
This is solved by a little workaround.
I decided to store the button data in the tag of the toolbar and not in the tag of the single button.
Works ok.
Things I don't like so much:
1) Setting a button Enabled/Disabled requires a method.
2) The button state has to be stored on every button click.
3) The toolbar tag is occupied.
If someone should have the same problem:
Attachment 185831
i would like to as a SubMenu to the ToolbarButonMenu, how can i get the hMenu(hWnd) for each item
Good point. The hMenu is created on demand and not persistent.
So, a solution could be that whenever the popup menu is created a new "InitButtonMenu" event is fired with a TbrButton object and a hMenu pointer. So the developer can adjust the hMenu before it get's displayed by the ToolBar.
What you think ?
Ok. But then there is a problem of the ButtonMenuClick. Currently it fires if wID is > 0 and passed that n-th wID to a ButtonMenu object.
We would need to cap that, so that ButtonMenuClick only fires if wID is not higher then the ButtonMenus.Count.
If the wID is not in that range and <> 0 then a new event shall be called, let's say "ButtonSubMenuClick" which just passes the wID and the developer is then responsible for mapping it. Of course the TbrButton class can be passed also for enrichement.
Your thoughts?
Any idea here Krool?Quote:
hi krool
I'm using your textboxes to display data in Arabic from database and they are doing very well.
However when adding data at runtime :
eg TextBoxW1.Text = "اللغة العربية" they are showing strange characters.
as opposed to VB textboxes which are showing data correctly at runtime but strange symbols from database.
eg Text1.Text = "اللغة العربية"
thanks
You can't apply unicode literals in the VB6 IDE. You need to use ChrW() for each character and append them together.
I suggest you could use it for VB.TextBox because maybe your machine is in DBCS mode, so the VB6 IDE is "looks like unicode aware", but only while you are in DBCS mode. And any shipment to a computer which is not in DBCS mode will fail later.
I think this would be a good start, although i haven't tested it yet, but i don't think that TrackPopupMenu could be used on an existing menu. i am going to test it and/or find another method to take advantage of this.
I would rather stay away from callbacks.
maybe somebody else here could give some idea...
be that as it may, it would help for those who want to use images in the menu.
Hello Krool!
Thank you for your great contribution and developed this control, which I have been using all the time. It's great!
Now there are two questions:
1. "DTPicker" control lacks "BackColor" and "ForeColor" attributes
2. The "BackColor" and "ForeColor" properties of the "MonthView" control do not work after being set (the background color and text color will not change)
Please help us to solve the above problems.
Thank you.
I see. Thank you very much
So bad that crashes on Win7 Ultimate SP1 i really wanted to see MSCC6 as Manifested
You probably saw it on the Discord but I'll add it here for tracking purposes...
Would be really nice to have an option for PictureAlignment when CommandButton style = graphical, so the image can appear to the left/right/bottom instead of just top. Setting the Alignment option has no impact.
On the toolbar Button the Style Placeholder is missing. So what I have been using until now is, to set the style as TbrButtonStyleSeparator and set the CustomWidth to the desired width.
Seems ok, But! when the toolbar Wrappable is true the button will not go immediately to the next row of the toolbar. Only after a button with the style is not TbrButtonStyleSeparator which is before the placeholder has also been moved to the next row
when checking the Button .Left and .Top properties it returns 0 on both, as a result any controls which are dependent on these coordinates move to position 0,0
This will also be if there are more then one placeholders in sequence; they will not move to next row of buttons until the wrap include the button before all the placeholder(s).
I hope I explained it enough...
to test it , create a toolbar with a few buttons, create a button TbrButtonStyleSeparator and set Customwidth to 2000, Autosize= false , create a few more buttons. set toolbar Wrappable =true
create a picturbox
in code
set Picturebox Container = toolbar
set the picturebox cords to the button cords
resize the form to the middle of the placeholder and repeat setting the picturebox cords to the button cords (use a form resize event to see it better)
I have tested it further.
if i put a TbrButtonStyleSeparator with Autosize=true before the placeholder then the .Left and .Top properties remain as old, but it will not move dow until all buttons with TbrButtonStyleSeparator in the sequence don't fit on the row
OLEGuids.tlb has implemented IStorage, Please do me a favor to add IStream interface so that I can get rid of 'Edanmo's OLE interfaces & fuctions V1.81' in a project and avoid conflicts.
The IStorage in oleguids is a stub, you can't use it.
But as noted oleexp.tlb has not modified it from olelib.tlb 1.81 so you can at least only have the two.Code:[
uuid(0000000B-0000-0000-C000-000000000046),
odl,
]
interface IStorage : IUnknown
{
// Not done, guid placeholder only
};
You're best bet it to just explicitly qualify them. Otherwise, the order the TLBs appear in the References dialog is the order they're resolved in if not qualified. Since VBCCR qualifies everything in it's code, it should be fine to just put it 2nd if you don't want to explicitly qualify everything yourself.
I would like to have a control to input a value with decimals, a numeric input for prices with specific accuracy (say 3 decimals). which from those control can do that, and how?
See the attached project
As you can see it is very simply, and you cand freely modify to add more property or events if you need.
You can put the total number of digits in the Precision property, and the decimal digits in Scal property , I want to call it Scale like in Oracle but is not posible.
All I try it works fine.
Thank you. I found another solution to include units, using Krool TextBoxW. I will post here in the CodeBank
Found an issue:
"Missing: OLE Guid and interface definitions"
I found the missing file in the demo folder. Not sure if that will help anybody else but for the demo to run, the reference needs to be changed.
Is it possible to bypass ListView limitation of item's max value length 259 characters?
Microsoft mscomctl.ocx doesn't have that limitation.
Code:With listView1.ListItems.Add(1, , "Col1")
.SubItems(1) = String$(1000, "=")
Debug.Print Len(.SubItems(1)) 'returns 259, mscomctl.ocx unlimited
End With