About transparency, you can communicate with me in this respect. I also like to make the controls more beautiful.
Printable View
StdPicture objects are restricted.
They can be "enhanced" by vtable hacks to allow gdi+.
However, that is the responsibility of the app todo and not of the VBCCR.
The pictures are "owned" by the app and VBCCR just "borrows" them. It would be dangerous if there is any action on the objects which will "change" them.
And doing private copies would kill "compatibility".
Anyhow, see below for a solution:
https://www.vbforums.com/showthread....to-Support-GDI
I have recently started using these common control replacements and have found that in the existing TabStrip control there is a way to disable 1 specific Tab to prevent it from being selected using an Enabled variable in the Tab object of the TabCollection, however I cannot clearly see a way to do so utilising the replacement, unless I rework the event handle to ignore input to that tab unless a seperate boolean is used to control the function.
Is such functionality not possible to expose, or is there a better alternative method?
the MS Common Control Tabstrip does not have an Enable Property for each tab (although I don't know why).
You are referring to the SSTab, which is a complete different control, which creates its own container for each tab.
to get around this limitation, you can use the TabBeforeClick Event.
I've been converting my application to the VBCCR Unicode controls, and added the VBFlexGrid (also by Krool) and the SSTabEx (by Eduardo) to the toolkit. I am very happy with the quality of the controls, and the great support that is given via this forum.
https://www.vbforums.com/showthread....68#post5517568
Krool,
I noticed there is no List property with your ComboBox. Is the ComboBox populated under program control only?
Krool,
I'm using your tab control and no text is being shown for Labels. Button and textboxes seem fine. It's like the Label control will not bind to the tab page at all. Link Labels seem to work.
Using VBCCR17.
Okay.
The form I'm trying to reproduce does have a frame around the controls I plan to use. I forgot to add it with the test of the tab page.
I put Mr. Freakout back in the closet. :)
I set the form to use pixel scaling mode which has been working fine until I got to adding controls to the tab page. It looks like twips is the only scale mode the tab page accepts.
Krool,
I decided to go with the SSTab control. It allows me to add controls to the pages in design time and easier to deal with. FWIW this control also only accepts twips. I guess that is just how it is.
Adding controls worked fine. My only comment was that if I use pixel scaling the tab pages only accepts twips, nothing else. As mentioned I moved to SSTab as I don't what to have to deal with separate forms for tab pages and only able to test in runtime.
My understanding is the tabstrip is just that. "Tab pages" are referred to as property pages which threw me for a loop. The tabstrip only shows the first page and clicking on the other tabs do nothing in the IDE. SSTab made that work like I expected. Thanks for the tip on using picturebox rather then frames to use pixel scaling.
Hi Krool,
Here is the result of our conversations. The picturebox frame replacement to get pixel scaling and using SSTab saved me a ton of time with this migration project I'm doing.
Attachment 181260
Hi krool ,
1- In toolbar , Is there a way to assign a font for a specific button instead of affecting all the buttons ? Like the ForeColor property that is assigned for the toolbar button .
The reason , to replace button images by font icons like font awesome as an example .
This will add flexibility to color changing and the size of the button graphics .
Dear Krool,
Thanks, as always, for your altruistic work.
I have been, for the first time, trying the CoolBar control since the past 2 or 3 days. I have an issue with UseChevron option.
I followed your instructions in https://www.vbforums.com/showthread....=1#post5002991, on how to avail the UseChevron option. The thing is that when the ideal width is reached, a white vertical strip appears but without the chevron symbol. When I click on that white strip, the BandChevronPushed event does get fired.
So, I experimented by ticking and unticking the various options in quite a few combinations. What worked finally was unticking the 'VisualStyles' option under 'General' tab. But then, naturally, the visual styles are gone. I created the ComCtlsDemo.exe (with 'VisualStyles' option ticked) and tried it. Only white strip appears. Clicking on it fired the BandChevronPushed event. I tried that same ComCtlsDemo.exe in a Win7 system. There also, same result.
So, am I missing something? How to make the chevron appear without unticking the 'VisualStyles' option?
And, one more question. After unticking the 'VisualStyles' option and making the chevron appear, I tried it for a band with Toolbar control. When the ideal width is reached, the chevron appears. But when I clicked the chevron, the hidden items of the toolbar control do not show up. Have we to show the hidden items manually by writing code in BandChevronPushed event?
Note:
- I am using the latest version of your controls (downloaded 2 days back)
- I am on Windows 10 Home. I created the ComCtlsDemo.exe therein only.
Kind Regards.
I found the bug and know how to fix it when I have time.
Meanwhile you can workaround it by setting the conditional compilation constant 'ImplementThemedReBarFix' to False.
This results that the ForeColor property though does not work anymore for a band. Also something else does not work in exotic circumstances.
That's why I have implemented such a themed "fix" and as side effect it allows custom fore color for a band.
What I simply missed was to draw the chevron. But that will be an easy one to fix I think as the v6 rebarbandinfo has the chevron rects and states.
Be patient, thanks.
Update released.
The RP_CHEVRON/RP_CHEVRONVERT parts are now included in the 'ImplementThemedReBarFix'. (reported by softv)
In this regard I found another bug. When the UseChevron property of a Band will be changed then the band's header portion will not be automatically refreshed.
As can be seen in the image below, after the UseChevron got applied, the text "asd" is truncated. Now with the bugfix the band's header portion will be refreshed. (.CXHeader member, RBBIM_HEADERSIZE, = -1)
Attachment 181447
Dear Krool,
Warm Greetings! And, Thanks a TON for the update.
By the by, I have one more observation to share. As far as I tested (trying out various options), the vbSizeWE mouse pointer was not getting set when mouse moves over the resizing portion (dotted line) of a child coolbar. By child coolbar, I mean a coolbar (say, cbr2) which is nested in one of the bands of a parent coolbar (say, cbr1). I tried putting cbr2 inside a frame too (the frame being inside one of the bands of cbr1)
As of now, my workaround is as follows. My 'cbr2' has 3 bands with 3 command buttons (as a control array) in them:
--
Private Sub cbr2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
cbr2.MousePointer = vbSizeWE
End Sub
Private Sub CommandButtonW_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
cbr2.MousePointer = vbNormal
End Sub
--
Sorry if I am wrong in my observation (which resulted in the above workaround). If there is indeed a straightforward solution, kindly let me know the same.
Ever in gratitude to your monumental work.
Kind regards.
I'm sorry for my bad English.
I am a user of VB6 only as a hobby, without extensive training. I learn by doing.
I was very happy when I discovered this great project. For me it is a boon. I got there looking for both a RichText control and a slider, both of which can be modified to suit my needs.
Regarding the slider I have already found a way to implement the resizing of the cursor (Thumb - TBS_FIXEDLENGTH - TBM_SETTHUMBLENGTH), so that it is more suitable for touch screens.
Would there be a not too difficult way to change the cursor image (Thumb)? If I'm not mistaken, I've seen the possibility exists (NM_CUSTOMDRAW - TBCD_THUMB) but I just don't know how to use it.
I found and resolved several critical errors that can cause controls to crash at runtime especially with multiple instances. Most of them are due to naming collisions with VB keywords, ie Format, Width, Height, Month, Day etc. Microsoft warned that overriding keywords can cause runtime/designtime errors to occur. I posted a video listing the errors that need to be addressed. A few of them are false positives due to an earlier error in the parsing. But, there are also false negatives hidden that appear once the original errors have been resolved. VBCCR17 name collision errors causing random crashes at runtime
Update released.
If the child control is only in the CoolBar "container" then there was no issue. But if it's a child control of a band (= child of ReBarWindow32) then the issue occured.
The CoolBar has been updated so the child controls can walk up the chain properly in the WM_SETCURSOR handler.
There is no workaround needed anymore.
I have tested it well, also in regards to Form.MousePointer in play etc. and this is the most straight forward solution for natural behavior in VB.
For those interested, the code marked in blue is the addition.
Can you provide samples to replicate such crashes ?Code:Case WM_SETCURSOR
If LoWord(lParam) = HTCLIENT Then
Dim hCursor As Long
If MousePointerID(PropMousePointer) <> 0 Then
hCursor = LoadCursor(0, MousePointerID(PropMousePointer))
ElseIf PropMousePointer = 99 Then
If Not PropMouseIcon Is Nothing Then hCursor = PropMouseIcon.Handle
End If
If hCursor <> 0 Then
SetCursor hCursor
WindowProcControl = 1
Exit Function
ElseIf hWnd <> wParam And wParam <> 0 Then
' Ensures that the cild controls can walk up the chain properly.
WindowProcControl = DefWindowProc(hWnd, wMsg, wParam, lParam)
Exit Function
End If
End If
[...]
WindowProcControl = ComCtlsDefaultProc(hWnd, wMsg, wParam, lParam)
It's a random thing at runtime as I said. Not all of the controls appear to have the problem. The only easy solution for me was to resolve any and all naming collisions to take the load off of the designer/runtime.
Did you see the video?
The word "Format" is causing the designer to jump to a definition in another procedure. But then, I tested after the video, and that word jumped correctly to the right definition.
Again, this problem is intermittent, aka random at design/runtime.
Microsoft said that you should not use those reserved words because design/runtime errors can occur.
Here is a list released by MS that includes Format, Width, Height etc.
Trust me, it serves no good purpose to use these words as parameters etc.Quote:
Abs Access AddItem AddNew Alias And Any App AppActivate Append AppendChunk
Arrange As Asc Atn Base Beep BeginTrans Binary ByVal Call Case CCur CDbl
ChDir ChDrive Chr Chr$ CInt Circle Clear Clipboard CLng Close Cls Command
Command$ CommitTrans Compare Const Control Controls Cos CreateDynaset CSng
CStr CurDir$ Currency CVar CVDate Data Date Date$ DateSerial DateValue Day
Debug Declare DefCur CefDbl DefInt DefLng DefSng DefStr DefVar Delete Dim
Dir Dir$ Do DoEvents Double Drag Dynaset Edit Else ElseIf End EndDoc EndIf
Environ$ EOF Eqv Erase Erl Err Error Error$ ExecuteSQL Exit Exp Explicit
False FieldSize FileAttr FileCopy FileDateTime FileLen Fix For Form Format
Format$ Forms FreeFile Function Get GetAttr GetChunk GetData DetFormat GetText
Global GoSub GoTo Hex Hex$ Hide Hour If Imp Input Input$ InputBox InputBox$
InStr Int Integer Is IsDate IsEmpty IsNull IsNumeric Kill LBound LCase
LCase$ Left Left$ Len Let Lib Like Line LinkExecute LinkPoke LinkRequest
LinkSend Load LoadPicture Loc Local Lock LOF Log Long Loop LSet LTrim
LTrim$ Me Mid Mid$ Minute MkDir Mod Month Move MoveFirst MoveLast MoveNext
MovePrevious MoveRelative MsgBox Name New NewPage Next NextBlock Not Nothing
Now Null Oct Oct$ On Open OpenDataBase Option Or Output Point Preserve
Print Printer PrintForm Private PSet Put QBColor Random Randomize Read ReDim
Refresh RegisterDataBase Rem RemoveItem Reset Restore Resume Return RGB Right
Right$ RmDir Rnd Rollback RSet RTrim RTrim$ SavePicture Scale Second Seek
Select SendKeys Set SetAttr SetData SetFocus SetText Sgn Shared Shell Show
Sin Single Space Space$ Spc Sqr Static Step Stop Str Str$ StrComp String
String$ Sub System Tab Tan Text TextHeight TextWidth Then Time Time$ Timer
TimeSerial TimeValue To Trim Trim$ True Type TypeOf UBound UCase UCase$
Unload Unlock Until Update Using Val Variant VarType Weekday Wend While
Width Write Xor Year ZOrder
Confirm the fix by changing the two/or-more affected functions in the RichTextBox module.
Now the variable/param can't jump to another function/sub.Code:Public Sub OLEObjectsAddFromPicture(ByVal Picture As IPictureDisp, Optional ByVal fmt As Variant)
'new body here
Format 'Right click Format token, then click goto definition in the object browser. Success!
End Sub
Public Sub SaveFile(ByVal FileName As String, Optional ByVal fmt As RtfLoadSaveFormatConstants = RtfLoadSaveFormatRTF, Optional ByVal SelectionOnly As Boolean)
'new body here
End Sub
Just so everyone can get an idea of the various ways these manifest, take a look at line 461 in the Slider module.
Looks ok, but it ran into a different kind of collision. Comment out the dimensions for Width and Height.Code:
Dim Width As Long, Height As Long
Width = .ScaleWidth
Height = .ScaleHeight
'some code end with
MoveWindow SliderHandle, 0, 0, Width, Height, 0
Now jump to definition from the param Width in the MoveWindow function.
You will end up jumping to the module property for Width, that expects an argument.
Technically, this word token should stay hidden and reserved for Width of Me.
Another kind of problem is assignments to constants not permitted. Line 958 of module CommonDialog.
The word "Color" is a member of LoadPictureConstants.
Line 158 of LvwColumnHeader. The word "Checked" is a member of OLE_TRISTATE.
Code should be explicitly named not to collide, because it causes a collective load at design/runtime.
Some other words to fixup are: Month, Day, DateValue. Some of these may have various layers of issues that can occur in different ways, because the month and day are used in a loop, and as properties, and as reserved words.
Could you describe steps by steps how to reproduce a single problem? (just one case, but clear)
Are you complaining that it is confusing the object browser when you look for a definition or what?
I want to see one example to reproduce this problem without altering the existing code like he described at #3157.
i only use the original compiled VBCCR OCX version and never expierend any problems.
Maybe you can run into this problem only when you use the source code?
I described enough for you to reproduce a design error that jumps between procedures. Confirm by changing the word/function "Format" to "fmt". I've been clear. You're not supposed to use reserved words. The compiler does an error parsing in a specific order, when looking for definitions deciding to filter a parsed error or not. Errors like that can cause false results as seen, because those words are seen globally. Why would you want to continue using the word Format if it can cause global jumps to unrelated parameters? I've presented a clear list of words that should not be used as parameters or variables.
What do you mean with that?
It compiles just fine, no errors.
What do you mean by "false results"??????
Where?
You didn't show anything.
What do you mean with "global jumps"? How to reproduce that "issue"?
Are you willing to help or what is this about?
Because it you are trying to help, do what I asked to you: detail step by step how to reproduce one problem.
And don't say that you already did because you did nothing so far, only loose and ambiguous claims about alleged errors that nobody knows what you are talking about.
I think you are unable to show anything, because the best you could do so far is to say "random errors" (that of course, only allegedly happen in your machine).
[Redacted as I like Eduardo]
The name "shadowing" problems are hypothetical. Can occur if changes are made in certain way so that some hideous errors are introduced unintentionally.
Highly doubt there are any actual problems that stem from using keywords for identifiers throughout the codebase, otherwise TTn would be the first to point these out.
cheers,
</wqw>
You are correct in the sense that there is no need to start a battle or flamewar, but I don't think that was the intention of Eduardo's post. If anything, he may have been a bit "protective".
If you go back through the nearly 3200 posts in this thread, you'll see that Krool (= the author) not only been has been giving this great set of controls free of charge to everybody, he also has been providing a great amount of support to everyone who had questions.
I'm not in the position to judge Ttn's claims, too technical for me, but as an "educated outsider" I'd be very surprised that what is claimed to be a "fundamental design error" only pops up after 9 years where the controls have been used in a large number of projects around the globe. I for example, have used these controls to replace 1700 controls in one of my apps, and have not experienced any problems.
Eduardo on the other hand, I think is in the position to judge Ttn's claims, as he's the author of the SSTabEx control which I see as an extension of the Krool's set of controls. So, I think all he was trying to do, it to get to the root of the problem.
Of course I didn't and don't want to start any flame war.
The problem, and the thing that I didn't like, is that he writes like he is addressing a serious problem, and the people that don't understand what he is saying might feel insecure using the controls, when in fact there is no problem at all.
The problem is if you modify the code without knowing what you are doing, but that's always a problem in any project.
About those words, that are not reserved keywords (otherwise VB wouldn't allow to compile) but names used by VB elsewhere, it is my personal opinion and what I usually do, is to avoid using them to avoid any possible confusion, but not because there is a real problem.
In the sake of now starting any flame war, I'm out of the thread (I don't mean forever :wave:).
Sorry, just one more message for completeness, here is a list of VB reserved keywords:
You cannot use those, VB won't allow.Quote:
Abs Any Array As Attribute Boolean ByRef Byte ByVal Call Case CBool CByte CCur CDate CDbl CDec CDecl CInt Circle CLng CLngLng CLngPtr Close Const CSng CStr Currency CVar CVErr Date Debug Decimal Declare DefBool DefByte DefCur DefDate DefDbl DefDec DefInt DefLng DefLngLng DefLngPtr DefObj DefSng DefStr DefVar Dim Do DoEvents Double Each Else ElseIf Empty End EndIf Enum Erase Event Exit False Fix For Friend Function Get Global GoSub GoTo If Implements In Input Input InputB Int Integer LBound Len LenB Let LINEINPUT Lock Long LongLong LongPtr Loop LSet Me New Next Nothing Null On Open Option Optional ParamArray Preserve Print Private PSet Public Put RaiseEvent ReDim Resume Return RSet Scale Scale Seek Select Set Sgn Shared Single Spc Static Stop String String Sub Tab Then To True Type UBound Unlock Until Variant VB_Base VB_Control VB_Creatable VB_Customizable VB_Description VB_Exposed VB_Ext_KEY VB_GlobalNameSpace VB_HelpID VB_Invoke_Func VB_Invoke_Property VB_Invoke_PropertyPut VB_Invoke_PropertyPutRefVB_MemberFlags VB_Name VB_PredeclaredId VB_ProcData VB_TemplateDerived VB_UserMemId VB_VarDescription VB_VarHelpID VB_VarMemberFlags VB_VarProcData VB_VarUserMemId Wend While With WithEvents Write Write
Taken from here.
Step 1. Locate the sub procedure called "OLEObjectsAddFromPicture", inside the "RichTextBox" module.
Step 2. Right Click the Variant parameter called "Format".
Step 3. Select "Definition" from the menu.
Step 4. Notice that VB jumps to a parameter of a completely different procedure called "SaveFile".
Step 5. Notice that the type of this parameter is "defined" as an emumeration not a variant:
Public Enum RtfLoadSaveFormatConstants
RtfLoadSaveFormatRTF = 0
RtfLoadSaveFormatText = 1
RtfLoadSaveFormatUnicodeText = 2
End Enum
6. Now, edit the parameter inside SaveFile, from "Format" to "fmt".
7. Navigate back to "OLEObjectsAddFromPicture procedure, and try again.
8. Notice that you jumped to another procedure this time called "LoadFile"
9. Edit the parameter inside LoadFile, from Format to fmt.
10. Try again, now you finally get the correct procedure with a variant definition.
But, you're still using a reserved definition that somehow can jump out from one procedure to another as another type. In a general use module, it would be better to clear this up. Or be stubborn about it, your choice. There are thousands of lines in the code, but the VBA 6.5 parser caught only a couple dozen.
Quitting drinking, having a headache is a good enough reason for being grumpy on any thread... my random thought for the day.
So, if TTn is correct (and I am not qualified to say either way) then it is just a matter of whether it is important or not. If it is both correct and important then Krool can weigh up the work and decide if he wants to make the change.
This is a bug in the IDE. Check this out:
Step 1. Locate the sub procedure called "OLEObjectsAddFromPicture", inside the "RichTextBox" module.
Step 2. Rename Variant parameter called "Format" to "fmt".
Step 3. Press F5 and get "Argument not optional" on IsMissing(Format) line
This comes to show that "Format" identifier inside "OLEObjectsAddFromPicture" is clearly not resolved as "Format" parameter neither of "SaveFile" not "LoadFile" functions. It is either a local parameter or the VBA.Format function.
VB6 parser is complicated mess. For instance in a class you can add a property called Left (like in Top, Left, Width, Height) but still in the same class in the body of its methods you can call str = Left(str, 5) to invoke VBA.Left without requiring libname prefix i.e. the compiler disambiguates on the number of parameters specifically for Left, otherwise every user-control and every user-form in every VB6 project would be mostly broken by having intrinsic Left property shadowing VBA.Left runtime function.
cheers,
</wqw>
Hi Krool,
The CommandButtonW with Style vbButtonGraphical does not support 32bpp Icon.
The reason as far as I understand is the use of ButtonPicture.Render in the WindowProcUserControl WM_DRAWITEM.
Is it possible to use the DrawState (like you do in case the Button is disabled and no DisabledPicture is provided)?
Something like this should work (DSS_NORMAL = 0)
ElseIf ButtonPicture.Type = vbPicTypeIcon Then
DrawState DIS.hDC, 0, 0, ButtonPicture.Handle, 0, X, Y, CX, CY, DST_ICON
This would be great!
Great Controls and Thanks.
Dear Krool,
Warm Greetings and Thanks as always for your invaluable controls.
Attachment 181706
Case1:
In the above picture (of a coolbar control with 2 bands), I need the space pointed to by the RED arrow to be of the same size as the space pointed to by the GREEN arrow.
Case2:
When the 'BandBorders' option is kept ticked, the same coolbar control appears as follows. Therein too, I do not need that much space (as pointed to by the RED arrow) between the control's edge and the band border. I just need the control in band 1 to fill that space leaving only a 1 pixel gap between the control and the band border (very similar to the way the control in the 2nd band leaves only a 1 pixel gap between its edge and the coolbar border).
May be by design, the spaces are so in the above cases. But, is there any way at all by which I can achieve what I want in the above cases? Case1 is the most important for me. Anyway, if it is achievable in both the cases, well and good. I presume if Case2 is achievable, Case1 will automatically be achieved (with 'BandBorders' option kept UNTICKED).
Attachment 181707
Hi Krool,
thanks again for the 32bpp alpha bitmaps and icons support in the CommandButtonW.
I have another question: Can you add an option for DoubleBuffering to the CommandButtonW?
It flickers (again with Style vbButtonGraphical + Icon) sometimes - noticeable especially once there are a bunch of Buttons on a form.
A quick test (copying the double buffering code from another of your controls) solved the problem.
Maybe there is another way to prevent the flicker - I think it has to do with the way the picture/icon is drawn onto the control.
Thanks.
Addendum:
The TextboxW with MultiLine property set to true seem to have the same flicker problem.
Addendum 2:
This affects way more controls.
A Test with the CommandButtonW (vbButtonGraphical) with the ClipControls set to false seems to solve the problem too.
Hi Krool, thanks for your work.
I am using your coolbars and statusbars and wanted to report these issues.
1) Statusbar with multiple panels including one with Autosize = Content. During the Form_Load set panel.Text with a string that exceeds the initial prefixed space and the text is cut.
At the moment I solved with:
2) I'm using a krool coolbar with an MS toolbar inside. But when opening the property page (to set child) I don't see the MS toolbar.Code:StatusBar1.Panels(2).Width = TextWidth(StatusBar1.Panels(2).Text) + 120
But if I add a fake krool toolbar, I can now see the MS toolbar.
Attached project with Form1 for view the bug and Form2 with workaround patch.
Attachment 181848
1) Update released. The problem was that the internal DisplayText was not immediately updated on setting a new panel.Text. (which is used for text measurement)
This got now fixed. (highlighted in blue)
2) The MS ToolBar gives a "Property is write-only" error when accessing a 'Get' ControlEnum.hWnd. Which I don't understand yet..Code:Friend Property Let FPanelText(ByVal Index As Long, ByVal Value As String)
If StatusBarHandle <> 0 Then
PropShadowPanels(Index).Text = Replace$(Value, vbTab, vbNullString)
Call SetPanelText(Index)
Call GetDisplayText(Index, PropShadowPanels(Index).DisplayText)
If PropShadowPanels(Index).AutoSize = SbrPanelAutoSizeContent Then Call SetParts
End If
End Property
I don't understand what you mean. Also the attachment isn't working..
The TextBoxW seems to be difficult to double-buffer. However, CommandButtonW/CheckBoxW/OptionButtonW (vbButtonGraphical) can be double-buffered.
VBCCR17 ought to be the last version. Perhaps I will just make them double-buffer someday without exposing a DoubleBuffer property..
Hey guys,
just want to let you know that i tested VBCCR17 with Windows 11 Pro Insider Preview 10.0.22000.51 (x64).
The control demo looks fine and my apps are running well too!
Attachment 181859
Hi Krool,
another request from me:
The LabelW BorderStyle single does not work anymore as it uses UserControl.Line and in a recent optimization the DrawStyle changed to Transparent.