Try this suggestion:
https://www.binaryworld.net/Main/Cod...spx?CodeId=348
Printable View
Try this suggestion:
https://www.binaryworld.net/Main/Cod...spx?CodeId=348
i think i have it. in twinbasic the setdata command is not ready, but i'm using the program called greenshot to capture the screen i want and placing it into the clipboard. from there in the twinbasic program i have a button which when pressed takes whatever is in the clipboard (the greenshot capture), and places it into the rich text control. this seems to be working. i need to test more. once i have the text and pic in the richtextbox is there a way to save the contains of the richtextbox to a file ? a file type that perhaps the richtextbox can load from on the form load event >
i got it. RTB.SaveFile("c:\dbaseform\mynote.rtf"). rtf format is default. i believe i have all the pieces i need. thanks to all.
Hello Krool,
With the toolbar: When I hold the Shift and blick a button, then Tb ButtonClick event doesn't fire.
What am I doing wrong?
Thanks!
not directed toward me but i believe i can answer this question. the shift + left mouse click together is a different event than just left mouse button.
for the left mouse button click you can just use the on click event. but for the shift + left mouse button click you are going to have to use the mouse down event. something like this:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
If Shift And acShiftMask Then
' Shift key was pressed during the left mouse click
' Add your code here to handle this event
Else
' Regular left mouse click
' Add your code here to handle this event
End If
End If
End Sub
No, not that.
Hallo Krool,
I found out the cause:
After I turned off "AllowCustomize" it works as I need!
I capture the Shift-Click in the TB Click-event - as I did with the Common Controls ocx version - in order to offer a second option to the click-event.
Thank you for your time!
Hi Krool,
I'm rewriting your TreeView control with RC6. One of the problems I've found is that when the TreeView control is loaded with hundreds of thousands of nodes, it takes a long time to release the control. While this is an old problem inherent in VB6-Apps, if the TreeView control doesn't solve this problem, then its use cases will be somewhat limited. MS-TreeView does not have this problem.
It's recommended to rewrite the class TvwNode with Olaf's LightWeight-COM technology to solve this problem completely.
Here's the test code:
Form1
Code:Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Command1_Click()
Dim i As Long, j As Long, k As Long, l As Long, m As Long, L1Nodes As Long, L2Nodes As Long, L3Nodes As Long, L4Nodes As Long
Dim lTotal As Long, t As Long
Dim oNode1 As TvwNode, oNode2 As TvwNode, oNode3 As TvwNode, oNode4 As TvwNode
'HScroll1AnimationSpeed.Value = 12
L1Nodes = 10: L2Nodes = 8: L3Nodes = 14: L4Nodes = 7
'L1Nodes = 20: L2Nodes = 16: L3Nodes = 28: L4Nodes = 14
'If chkLargeData.Value = 1 Then
L1Nodes = 30: L2Nodes = 24: L3Nodes = 42: L4Nodes = 21
'End If
lTotal = (L1Nodes * L2Nodes * L3Nodes * L4Nodes) + (L1Nodes * L2Nodes * L3Nodes) + (L1Nodes * L2Nodes) + L1Nodes
Randomize
TreeView1.Nodes.Clear
t = GetTickCount
TreeView1.Visible = False
With TreeView1.Nodes
For i = 1 To L1Nodes
m = m + 1
Set oNode1 = .Add(, , "1:" & i, RandomCaption & "Staff Member" & m) ' , "Staff Member"
For j = 1 To L2Nodes
m = m + 1
Set oNode2 = .Add(oNode1, TvwNodeRelationshipChild, "1:" & i & "-2" & j, RandomCaption & "Folder " & m) ' , "Folder"
For k = 1 To L3Nodes
m = m + 1
Set oNode3 = .Add(oNode2, TvwNodeRelationshipChild, "1:" & i & "-2" & j & "-3" & k, RandomCaption & "Event " & m) ' , "Event"
For l = 1 To L4Nodes
m = m + 1
If Rnd < 0.8 Then
Set oNode4 = .Add(oNode3, TvwNodeRelationshipChild, "1:" & i & "-2" & j & "-3" & k & "-4" & l, RandomCaption & "Appointment " & m) ' , "Appointment"
Else
Set oNode4 = .Add(oNode3, TvwNodeRelationshipChild, "1:" & i & "-2" & j & "-3" & k & "-4" & l, RandomCaption & "Event Note " & m) ' , "Note"
End If
Next l
Next k
Next j
Next i
.Add , , "Cog", "Settings" ', "COG" ' , "Cog"
.Add , , "Search", "Searches" ', "SEARCH" ' , "Search"
End With
MsgBox TreeView1.Nodes.Count + 10 & " sorted nodes added in " & (GetTickCount - t) / 1000 & " seconds"
'New_c.Timing True
t = GetTickCount
TreeView1.Visible = True
TreeView1.ZOrder 0
MsgBox "Show TreeView1: " & (GetTickCount - t) / 1000 & " seconds"
Command1.Enabled = False
End Sub
Private Sub Form_Load()
'InitResources
'InitResources2
End Sub
Private Function RandomCaption() As String
Dim s(1 To 7) As String
s(1) = "Alpha ": s(2) = "Bravo ": s(3) = "Charlie ": s(4) = "Delta ": s(5) = "Echo ": s(6) = "Foxtrot ": s(7) = "Golf "
RandomCaption = s(Int(Rnd * 7) + 1)
End Function
Might be worth trying the twinBasic VBCCR package to test its performance, it shouldn't exhibiting VB6's pathological destruction behaviour.
For example, here's an object destruction comparison with VB RC6 and a tB compiled version:
RC6
Attachment 194158
tB RC5
Attachment 194159
~2x instantiate improvement and ~1000x destruction improvement.
tbRichClient5? That’s interesting!
Yeah! tB is now capable of compiling (an admittedly very old version of) RC5, so I suspect it should be possible to compile RC6 too. In theory a port to 64-bit should also be doable, albeit with a lot of work for anything using APIs, pointers, etc...still, it's significant progress and quite exciting.
Anyway this is getting off topic, so we best move on (sorry Krool!)
About fast creation / destruction.
Let's hope that soon a tB compilation for VB6 can solve that issue.
LISTBOXW question
See sample project:
Attachment 194181
When a ListBoxW loses focus, it flickers.
Up to now I couldn't find a way around this.
Can you help?
Works fine for me.
Of course, setting a focus on a MouseMove will cause flickering of the edit box.
This can be prevented by setting the focus only if the edit box is the me.ActiveControl.
It's about the flashing ListboxW on losing focus. Setfocus on MouseMove is for demo only.
I don't see it flashing.
(LISTBOXW problem)
You are right.Quote:
I don't see it flashing.
There is no flashing when Visual Styles are not in use.
This project uses Visual Styles (you need to compile the project to see the effect):
Attachment 194184
About the MouseMove over a Textbox and Setfocus:
In the main app, there are some controls which steal the focus on a MouseMove.
These controls are not VB or VBCCR controls.
I'm not sure if I can change their behavior.
@Krool:
I tried the same in tB 670.
No flicker in the ListBox!
Some (expected) flicker in the TextBox, that's another story, and of no interest here.
Unfortunately the *.twinproj is too large to upload here, 6MB uncompressed, 1.5MB ZIP.
I wonder why it is that big.
When I import Project10.vbp into tB the size is about 10 KB.
Attachment 194185
Attachment 194196
Download and remove the zip extension.
I have a kind of 'solution'.
In the ListBoxW source, I added a DoEvents on WM_KILLFOCUS:
This fixes the flickering completely.Code:Private Function WindowProcControl(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wMsg
Case WM_SETFOCUS
If wParam <> UserControl.hWnd Then SetFocusAPI UserControl.hWnd: Exit Function
Call ActivateIPAO(Me)
Case WM_KILLFOCUS
Debug.Print "WM_KILLFOCUS"
DoEvents
Call DeActivateIPAO
Case ...
I'm not sure yet if there are side effects from this addition.
Later:
I don't feel fine with the DoEvents.
So I tried this:
Exit Function cures the flicker as well.Code:Case WM_KILLFOCUS
Debug.Print "WM_KILLFOCUS"
Call DeActivateIPAO
Exit Function
First time trying any of Krool's controls, using the latest OCX, I see at most four events max for any control, Gotfocus, Lostfocus, Dragover, Dragdrop. Guess I'll have to finally try a bootleg VB6 or nothing. I have several of these I downloaded years ago but was always too much of a scaredy cat install them.
If you could give more information, do you have VB6 SP6? What OS are you using? What are the steps you took in your attempt to use it?
EDIT: Screenshot https://imgur.com/a/6Q1zIdI
I simply downloaded VBCCR18.OCX.rar, unzipped the OCX into a project folder. Added it to the toolbox and am able to use the controls as described. (I just added one to test in the screenshot)
Thanks for offering to help. Hard to believe, but I'm still using VB5. A bit easier to believe, on Win 7. I gotta say, seeing all the crap folks go through with 10 and 11, 7 is bliss. I avoid web zero-day security issues by using the best script blocker ever, UMatrix. Too bad Google has made browser extensions less powerful for users of new versions of Chrome based browsers when they finally dropped manifest v2 for v3, which takes away extension's ability to hook into and filter traffic. But since I'm using Win 7, I can't even upgrade to the newer browsers, so UMatrix will keep working at Manifest v2 level.
I was able to get the OCX onto the toolbar without any problem. Then after fiddling around a while with some of the controls I finally noticed with the listview that there were only the four events. Then I checked a few more controls to find the same. Maybe it's something to do with the COM plumbing between v5 and 6, some interface version issue.
But seriously I don't have a clue. I saw where Krool wrote something to the effect that one would not have a good time using his controls on VB5, lol. So I was warned!
On a thread here I found the link to WinWorldPC, an abandonware site that appears to be quite trustworthy. I downloaded the one VB6 ISO the site has, the Enterprise version, did the checksum, fine.. Then I tried something else, used Wayback to find an old version of the same page from 2014. It had mirror download links all different from on the present day page, and on the one I tried, on a French server, STILL ALIVE! So I downloaded that.. identical to the first copy I downloaded from the 2024 page. And now I've also located the final cumulative service pack 6 which is still available from MS, and the security rollups, which some say are half baked and might mess up things. I haven't gotten to installing yet, so much crap to get out of the way first..
Ah, I see yeah definitely want to move VB up. You may consider twinBASIC as well. Here is the forum https://www.vbforums.com/forumdisplay.php?108-TwinBASIC
I use Widows 11 Pro w/o issues, but I like to keep my hardware fairly updated (within 4-5 years, though I just updated to a 9070X to beat the tariffs hitting our shores now, my setup was overdue)
I will say, Win 7 was awesome and I miss its performance. Even with 48gb DDR5 RAM, RX 7800XT and fast M.2 NVMe drives, Win 11 doesn't feel as snappy as Win 7 does even in a Virtualbox VM ha!
(truth be told I've not spent much time fine tuning since building it on the 6th)
Good luck with your updates, that'll take a bit of work.
It is also happening "sometimes" in the VB6 ListBox when using visual styles. So, I get the feeling that this is something to do with the underlying API window class and not specific with VBCCR.
Of course when somebody can provide a clever solution it would be good. To just cancel out WM_KILLFOCUS sounds like getting side-effects.
I don't cancel WM_KILLFOCUS, I only exit the message processing after work is done.
Then new messages can come in and are processed.
Perhaps I think too simple?
Anyway, I use the control with the Exit Function change for ~ 10 days now successfully.
No side effects to observe... try it.
Hi Krool and others,
I have a a question about the combobox control.
I'm using it in a search form where the user first selects a fields from the first list. This populates the second combo with the unique values from a database. As the search can more than "equal to" (e.g. larger than, smaller than, etc.) I'm using the style CboStyleDropDownCombo for the second combo.
However, some of the fields don't allow free text of numbers, but are Yes/No, or another fixed set of options like different statuses. In that case I prefer the combo style to be CboStyleDropDownList.
Now I discovered that this setting can't be changed at runtime. What would be the best way around this?
Thanks,
Erwin
I always go for the most simple solution.
In this case I would have multiple (hidden) combobox controls on my form and then show and use the one which suits the current needs.
Thanks for the great work.
I would like to report a strange behavior in the FrameW control.
When using multiple subframes inside a frame sometimes a black line appears above one of the subframes.
The same thing also happens when overlapping frames containing other frames.
I attach some screenshots of my project to illustrate the strange effect.
This is the main window in the design phase. The frame that creates problems is the OTHER SOUND SYSTEM subframe contained in the lowest frame (MIDI DEVICES MANAGER).
Attachment 194435
This is the Main window of my project in the execution phase.
Attachment 194436
This is the same window with the MIDI DEVICES MANAGER frame repositioned and displayed.
The strange effect with the black line does not appear yet.
Attachment 194437
I noticed that the black line effect never appears if the subframe is not completely contained within the main window (red arrow).
When instead the frame is moved up so as to be entirely contained in the window the black line effect always appears above the frame (red arrow).
Attachment 194438
I also noticed that the first time I reposition and display the MIDI DEVICES MANAGER main frame the black line never appears.
Attachment 194439
But the black line always appears from the second time I display the MIDI DEVICES MANAGER frame.
I tried changing various graphic settings but the black line effect always appears. So I think it is some kind of control bug.
I thought I would report it so that it can be used to further improve the CommonControls Replacement project.
Thanks for your attention.
Yes, I also see that happening!
The issue with the black line appears to be the DrawThemeParentBackground and the WM_PRINTCLIENT handler.
So, either I remove the WM_PRINTCLIENT handler or remove the DrawThemeParentBackground.
Since it makes maybe sense for "transparent" BP_GROUPBOX style windows to use DrawThemeParentBackground it makes definitely no sense for the FrameW control which is isolated in a UserControl with a fixed BackColor.
The "Transparent" property of the FrameW can be used to draw a fake replica of the parent background already. So there is no need here for DrawThemeParentBackground.
Update released. Fixed. Thanks for reporting !