Re: The 1001 questions about vbRichClient5 (2020-04-17)
Originally Posted by dreammanor
Hi Olaf, cDynFactory works very well now. Thank you so much.
I still have a few questions:
(1) Is it possible to implement dynamic properties names containing spaces or special characters (similar to keywords in cCollection), for example:
(2) Is it possible to associate cDynFactory with cCollection so that the dynamic properties of cDynFactory are like keywords of cCollection.
(3) Is there a limit to the number of dynamic properties of cDynFactory? Can cDynFactory have as many dynamic properties as cCollection?
(4) If cDynFactory is heavily used, does cDynFactory occupy more or less memory than cCollection? Thanks.
Are you sure, you want all this in an Object with Dynamic Properties?
Seems to me, that you're better advised, to use the cCollection (or an adapted cHashD) for all this.
E.g. when you currently write:
DynObj.SomeProp
you can (using a VB- or cCollection) write something equally short:
SomeCol!SomeProp
... using the Bang-Operator instead of a Dot.
And for "Spaces in Keys" the bang-operator also has support:
SomeCol![Some Prop]
To adapt cHashD to that behaviour, you will only have to make its Item-Prop the Default-Prop.
Re: The 1001 questions about vbRichClient5 (2020-04-17)
Hi Olaf, my idea is this:
(1) Added a member variable "Private m_Data As cCollection" in cDynFactory
(2) Map dynamic properties to the keywords of m_Data
=======================================
There are two minor problems with using the bang-operator:
(1) The characters in the bang-operator will affect the case of all variables in the project, for example:
SomeCol![hello andy] will make all Hello variables in the project become hello, all Andy variables becomes andy.
(2) Before using the bang-operators on the properties of cCollection or cHashD, these properties must be initialized first(give each property an initial value), for example:
Re: The 1001 questions about vbRichClient5 (2020-04-17)
Originally Posted by dreammanor
(2) Before using the bang-operators on the properties of cCollection or cHashD, these properties must be initialized first(give each property an initial value), for
Since the code for or cHashD is open, you can adjust the:
- Item Let/Set Prop
- Item Get Prop
Routines to your liking...
e.g.:
- making 'Item' the Default-Prop
- but also with regards to autocreating entries in Let/Set (in case PropKey doesn't exist)
- and also what to return, when the Get-Prop doesn't find an existing "PropKey"
In the cCollection I don't want to change the current behaviour,
because of the risk of breaking someone elses Code, which relies on the current Error-Throwing.
Re: The 1001 questions about vbRichClient5 (2020-04-17)
Yes, I took a similar approach to what you said. I encapsulated cCollection again and set Item as the default-prop. But the default-prop can only be the first-level property, for example: SomeCol("SomeProp") is valid, but ParentCol.SomeCol("SomeProp") will be wrong.
But it doesn't matter, I've migrated the development environment from XP to Win10 (instead of Win7 as mentioned earlier). Now I don't need to translate JavaScript code into VB6 code. I'll use UglifyJS directly in VB6 on Win10 to compress the JS code, but this solution is not perfect, because UglifyJS still cannot recognize the new JS syntax (such as "let") in JScript9, and RegExp in JScript9 cannot support the Unlicode parameter "/u".
Of course, if cDynFactory could be combined with cCollection, it's still a wondeful thing.
Qustion 046: How to make RC5.WebServer only process the data of its own window?
Qustion 046: How to make RC5.WebServer only process the data of its own window?
Both RC5.WebServer in Form1 and Form2 are listening on "127.0.0.1: 8282", how to make ws_ProcessRequest in Form1 only handle DoSomething_01, and ws_ProcessRequest in Form2 only handle DoSomething_02?
Or, is it possible to simulate the use of Web-APIs to process the data in Form1 and Form2 separately? Thanks!
Form1
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_01
End Sub
Form2
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_02
End Sub
Note:
Form1 and Form2 may be loaded sequentially or simultaneously.
Last edited by dreammanor; Apr 25th, 2020 at 10:31 AM.
Re: Qustion 046: How to make RC5.WebServer only process the data of its own window?
Originally Posted by dreammanor
Qustion 046: How to make RC5.WebServer only process the data of its own window?
Both RC5.WebServer in Form1 and Form2 are listening on "127.0.0.1: 8282", how to make ws_ProcessRequest in Form1 only handle DoSomething_01, and ws_ProcessRequest in Form2 only handle DoSomething_02?
Or, is it possible to simulate the use of Web-APIs to process the data in Form1 and Form2 separately? Thanks!
Form1
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_01
End Sub
Form2
Code:
Private Sub Form_Load()
Set ws = New_c.WebServer
ws.Listen App.Path, "127.0.0.1", 8282
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
'DoSomething_02
End Sub
Note:
Form1 and Form2 may be loaded sequentially or simultaneously.
Either make the separate ws-instances (which are currently "per Form") listen on different Ports,
or just wrap the ws - Object in a separate Class (e.g. cSharedServer)...
From within cSharedServer you could then delegate to (Public Boolean-returning Functions in) as many Form-Instances as you like.
e.g. (ws_event-handler within cSharedServer):
Code:
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
If Form1.HandleRequest(Request) Then Exit Sub
If Form2.HandleRequest(Request) Then Exit Sub
'... a.s.o.
End Sub
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Hi Olaf, I found a phenomenon:
In VB6 IDE, if RC5.Subclass or vbWidgets-related code is used in the VB6-Forms, after the VB6-Forms exit and return to design mode, at this time, if I open the VB6 Object-Browser window and drag the sub-window dividing line with the mouse, then the mouse is always in the "splitting-dragging" state, and cannot exit from the Object-Browser window, resulting in the entire VB6 IDE windows being frozen.
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Originally Posted by dreammanor
Hi Olaf, I found a phenomenon:
In VB6 IDE, if RC5.Subclass or vbWidgets-related code is used in the VB6-Forms, after the VB6-Forms exit and return to design mode, at this time, if I open the VB6 Object-Browser window and drag the sub-window dividing line with the mouse, then the mouse is always in the "splitting-dragging" state, and cannot exit from the Object-Browser window, resulting in the entire VB6 IDE windows being frozen.
This phenomenon has occurred many times.
I've encountered this a few times (on Win7 and Win8), but only when the project contained an MS-BrowserControl.
Have not seen it anymore on a fully up-to-date Win10.
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Yes, MS-Browser Control is used in my forms. Maybe it's because I didn't install the patch for Win10 (I turned off the automatic upgrade option for Win10).
I'm thinking, if I use "Set wbExt = Controls.Add("Shell.Explorer.2", "wbExt")" instead of MS-Browser Control, will it avoid this situation?
Last edited by dreammanor; Apr 26th, 2020 at 12:29 PM.
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Originally Posted by dreammanor
I'm thinking, if I use "Set wbExt = Controls.Add("Shell.Explorer.2", "wbExt")" instead of MS-Browser Control, will it avoid this situation?
This is worth a try ... (maybe the behaviour I was seeing on Win7 and Win8 was also due to using the IE-Control early-bound,
am working since about 3 years now strictly latebound with the Browser-Control,
to avoid Interface-incompatibilities between the "Win/IE-Version used for compiling" and the "Win/IE-Versions the App gets deployed to".
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Hi Olaf, I did further testing and found that the problem was indeed caused by the IE-Control. But even if I delete IE-Control and use "Set wbExt = Controls.Add (" Shell.Explorer.2 "," wbExt ")" for late binding, the problem still cannot be eliminated.
Last edited by dreammanor; Apr 27th, 2020 at 11:16 AM.
Re: The 1001 questions about vbRichClient5 (2020-04-25)
Originally Posted by dreammanor
Hi Olaf, I did further testing and found that the problem was indeed caused by the IE-Control. But even if I delete IE-Control and use "Set wbExt = Controls.Add (" Shell.Explorer.2 "," wbExt ")" for late binding, the problem still cannot be eliminated.
You're right...
(sorry, my former assumption that this was gone on a recent Win10 -
doesn't hold up to a concrete test, which I've done now)...
For anybody who want's to reproduce this "possessive IE-Control-Bug, influencing the VB-IDE, once navigating at least once":
Here some minimal-code for a virginal VB6-Form-Project ...
(without additional Controls or References... so the RC5 doesn't have anything to do with it):
Code:
Option Explicit
Private wbExt As VBControlExtender
Private Sub Form_Load()
Set wbExt = Controls.Add("Shell.Explorer.2", "wbExt")
wbExt.Visible = True
wbExt.object.Navigate2 "about:blank"
End Sub
After the above snippet was pasted into the Form (and at least run once -> calling .Navigate2 is important),
the VB6-IDE ObjectExplorer will not recover from a "TileSplitter-MouseDrag-Operation"...
The IDE will now remain stuck in an Endless-Loop within the Splitter-DragOp, never coming out of there ...
(causing 100% CPU-load on a single CPU-Core - and that's how you can detect this VB6-Task in the TaskManager, to kill it from there).
Re: The 1001 questions about vbRichClient5 (2019-07-28)
Originally Posted by Schmidt
You don't need the WebServer-instance, to make that work.
Here some code, which will work on an empty (normal) VB-Form -
only a reference to vbWidgets and vbRichClient5 is required:
Code:
Option Explicit
Private WithEvents Panel As cWidgetForm, WithEvents WB As cwBrowser
Private Sub Form_Load()
Set Panel = Cairo.WidgetForms.CreateChild(hWnd)
Set WB = Panel.Widgets.Add(New cwBrowser, "WB")
WB.WebKit.Navigate2 "file:///" & Replace(App.Path & "\CLEditor\index.html", "\", "/")
End Sub
Private Sub Form_Resize()
ScaleMode = vbPixels
Panel.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub Panel_ResizeWithDimensions(ByVal NewWidth As Long, ByVal NewHeight As Long)
WB.Widget.Move -1, -1, NewWidth + 3, NewHeight
End Sub
The magenta-colored part is the important one...
(a SubFolder, named \CLEditor sits below the App-Path, and contains the unzipped CLEditor-package).
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Hi Olaf, when I dynamically generated index.html in "ws_ProcessRequest (Request As vbRichClient5.cWebRequest)", CLEditor did not load successfully.
Code:
Option Explicit
Private wa As cWebArchive, WithEvents ws As cWebServer
Private wb, wbExt As VBControlExtender
Private Sub Form_Load()
With New cIEFeatures
.FEATURE_BROWSER_EMULATION = Int(Val(.InstalledVersion)) 'elevate the Browser-Version from its default-version 7
End With
If App.LogMode = 0 Then 'as long as in IDE-Mode, we re-create the *.wac every time
Set wa = New_c.WebArchive
wa.ReadContentsFromDirectory App.Path & "\WebAppRoot\"
wa.SaveContentsToArchiveFile App.Path & "\WebRoot.wac"
End If
Set wa = New_c.WebArchive(App.Path & "\WebRoot.wac") 'init the WA from the *.wac-Archive-File
Set ws = New_c.WebServer 'create an InProcess-WebServer-instance
ws.Listen App.Path & "\WebAppRoot\", "127.0.0.1", 8888
InitBrowser "http://127.0.0.1:8888"
End Sub
Private Sub InitBrowser(Optional URL As String = "about:blank")
Set wbExt = Controls.Add("Shell.Explorer.2", "wbExt") 'only after the above went through, are we allowed to create a BrowserControl
wbExt.Parent.Visible = True
wbExt.Move 0, 0, 7200, 1920
'wbExt.Move 0, 0, ScaleWidth, ScaleHeight
wbExt.Visible = True
Set wb = wbExt.object
wb.silent = True
wb.Navigate2 URL
Do Until wb.readyState = 4: DoEvents: Loop
End Sub
Private Sub Form_Resize()
If Not wbExt Is Nothing Then wbExt.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub ws_ProcessRequest(Request As vbRichClient5.cWebRequest)
Dim sURL As String: sURL = Request.URL
Select Case sURL
Case "", "/" 'a "naked" Root-URL-request (so we send the Start-(Home-)Page)
With New_c.ArrayList(vbString) 'let's build the html-response-string
.Add "<!DOCTYPE html>"
.Add "<html>"
.Add "<head>"
.Add " <link rel=""stylesheet"" href=""jquery.cleditor.css"" />"
.Add " <script src=""jquery-3.1.1.min.js""></script>"
.Add " <script src=""jquery.cleditor.min.js""></script>"
.Add " <script>"
.Add " $(document).ready(function () { cleditor($(""#input""),{height:""100%""}); });"
.Add " </script>"
.Add "</head>"
.Add "<body style=""margin:0; padding:0; border:0; overflow:hidden;"">"
.Add " <div style=""position:absolute; left:0px; right:0px; width:100%; top:0px; bottom:0px; height:100%;"">"
.Add " <textarea id=""input"" name=""input""></textarea>"
.Add " </div>"
.Add "</body>"
.Add "</html>"
Request.Response.SetResponseDataBytes New_c.Crypt.VBStringToUTF8(.Join(vbLf)) 'send it to the Browser
End With
Case Else
Dim RelPath As String, B() As Byte
RelPath = Replace(IIf(Len(sURL), sURL, "index.html"), "/", "\")
If Dir(Request.RootDirectory & RelPath, vbNormal) <> "" Then
Debug.Print Request.RootDirectory & RelPath
'B = wa.GetContent(RelPath) 'use the InMem-WebArchive to return the bytecontent of our Static-files
B = New_c.FSO.ReadByteContent(Request.RootDirectory & RelPath) 'alternative delivery of bytes from the FS
Request.Response.SetResponseDataBytes B
Else
Debug.Print "File not found: " & Request.RootDirectory & RelPath
End If
End Select
End Sub
Last edited by dreammanor; May 2nd, 2020 at 06:14 AM.
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Added the statement: .Add " <script src=""jquery-3.1.1.min.js""></script>"
Re-posted the test project. The problem seems to be in the following statement:
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Originally Posted by dreammanor
Hi Olaf, when I dynamically generated index.html in "ws_ProcessRequest (Request As vbRichClient5.cWebRequest)", CLEditor did not load successfully.
You've forgot to pre-load jquery in your index-html definitions.
And also, when you place byte-arrays in the Response-Object
(and not FileNames, which can "speak for themselves" regarding their MIME-Type),
you'll have to set the Response.ContentType explicitly in your Event-Handler.
Here's your Zip with all necessary corrections: CLEditor.zip
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Hi Olaf, before seeing your reply, I just solved this problem myself:
Code:
...
...
Case Else
Dim RelPath As String, B() As Byte
RelPath = Replace(IIf(Len(sURL), sURL, "index.html"), "/", "\")
If Dir(Request.RootDirectory & RelPath, vbNormal) <> "" Then
If Right$(RelPath, 4) = ".css" Then
'Debug.Assert False
Request.Response.ContentType = "text/css; text/html; charset=UTF-8"
End If
Debug.Print Request.RootDirectory & RelPath
'B = wa.GetContent(RelPath) 'use the InMem-WebArchive to return the bytecontent of our Static-files
B = New_c.FSO.ReadByteContent(Request.RootDirectory & RelPath) 'alternative delivery of bytes from the FS
Request.Response.SetResponseDataBytes B
Else
Debug.Print "File not found: " & Request.RootDirectory & RelPath
End If
End Select
But, obviously, your method is more concise, professional and elegant. Much appreciated.
In addition, I encountered more problems when using CKEditor4. I'll try to solve these problems myself. If I can't solve it, I'll have to ask for your help and guidance again.
Last edited by dreammanor; May 2nd, 2020 at 06:58 AM.
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Originally Posted by dreammanor
In addition, I encountered more problems when using CKEditor4. I'll try to solve these problems myself. If I can't solve it, I'll have to ask for your help and guidance again.
The newest versions of some of the more popular js-libs tend to leave out IE-support completely
(so they wouldn't work in the IE-Control, no matter if "uplifted" via cIEFeatures.cls or not)...
FWIW, ... I have already a VB6-WrapperClass for the (Chromium-based) MS-Edge-BrowserControl working (for the most parts) -
but since the MS-Base-API for the Control-binding is "still changing", I'll release it only after the new Edge-engine
ships officially with Win10-builds.
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Originally Posted by Schmidt
The newest versions of some of the more popular js-libs tend to leave out IE-support completely
(so they wouldn't work in the IE-Control, no matter if "uplifted" via cIEFeatures.cls or not)...
FWIW, ... I have already a VB6-WrapperClass for the (Chromium-based) MS-Edge-BrowserControl working (for the most parts) -
but since the MS-Base-API for the Control-binding is "still changing", I'll release it only after the new Edge-engine
ships officially with Win10-builds.
Olaf
It's really good news. This morning, I tested CKEdior5, which does not support IE and Ms-Edge at all, which makes me very frustrated. Looking forward to your VB6-WrapperClass for the (Chromium-based) MS-Edge-BrowserControl. Much appreciated.
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Originally Posted by Schmidt
The newest versions of some of the more popular js-libs tend to leave out IE-support completely
(so they wouldn't work in the IE-Control, no matter if "uplifted" via cIEFeatures.cls or not)...
FWIW, ... I have already a VB6-WrapperClass for the (Chromium-based) MS-Edge-BrowserControl working (for the most parts) -
but since the MS-Base-API for the Control-binding is "still changing", I'll release it only after the new Edge-engine
ships officially with Win10-builds.
Olaf
That would be great! Will communication between javascript and the host (vb6) be possible?
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Set DG.DataSource = Rs.DataSource err:
'-2147221504 (80040000)':
ADO needs to be installed to use DataBinding
Code:
Private Sub UpdateDataGrid(DG As DataGrid, SQL As String)
Set DG.DataSource = Nothing
Set Rs = Cnn.OpenRecordset(SQL)
MsgBox Rs.RecordCount
Set DG.DataSource = Rs.DataSource
End Sub
Re: The 1001 questions about vbRichClient5 (2020-04-28)
Originally Posted by xiaoyao
Set DG.DataSource = Rs.DataSource err:
'-2147221504 (80040000)':
ADO needs to be installed to use DataBinding
Code:
Private Sub UpdateDataGrid(DG As DataGrid, SQL As String)
Set DG.DataSource = Nothing
Set Rs = Cnn.OpenRecordset(SQL)
MsgBox Rs.RecordCount
Set DG.DataSource = Rs.DataSource
End Sub
Please post complete Demo-Code ...
(either in a Zip, or in a fully "self-contained" Code-Snippet like the one below):
Code:
Option Explicit
Private Rs As cRecordset
Private Sub Form_Load()
With New_c.Connection(, DBCreateInMemory)
.Execute "Create Table T(ID Integer Primary Key, Txt Text)"
.Execute "Insert Into T(Txt) Values('Text 1')"
.Execute "Insert Into T(Txt) Values('Text 2')"
.Execute "Insert Into T(Txt) Values('Text 3')"
Set Rs = .OpenRecordset("Select * From T")
End With
MsgBox Rs.RecordCount
Set DataGrid1.DataSource = Rs.DataSource
End Sub
From the Error-Message you got, I'd think my little example above will produce the same thing.
Because that Message points to a "messed up ADO-installation"
(for ADO-DataBinding with RC5-cRecordsets, the OleDB-SimpleProvider is needed, which comes "along with ADO").
Also a "messed up VB6-installation" could be the cause, due to the VB.DataGrid-dependencies to:
- DBADAPT.dll
- MSSTDFMT.dll
- MSBIND.dll
If those are not properly installed or registered on your Win-Machine, Bindings to the VB6-DataGrid will not work properly.
I recommend, to use "non-ADO-based Bindings" with SQLite, to work completely "MS-dependency-free".
(I've included the OleDB-SimpleProvider-Binding-Mode on cRecordsets only for "legacy-purposes").
I know RC5.Cairo is a good choice, but Cairo does not seem to be too convenient when dealing with single pixels. So I plan to use RC5.Win32_DC as my drawing tool to replace wqweto's cMemDC. But when the program runs to RC5.DC.DrawLine, VB6-IDE will make an error and exit. I don't know why.
Form1
Code:
'--- draw bar selector with RC5_Win32_DC ---
Private Sub DrawBarSelector_RC5_Win32()
Dim DIB As cDIB, DC As cDC
Dim nIdx As Long
Set DIB = New_c.DIB(BAR_WIDTH + 13, 7) 'create the DIB-instance (using a Constructor)
DIB.Fill MASK_COLOR 'ensure a BackGround-Fill on the complete DIB-area
Set DC = New_c.DC(DIB) 'create a DC-instance (using the Constructor, to select the DIB)
For nIdx = 1 To 4
DC.DrawLine nIdx, nIdx, nIdx, 7 - nIdx
DC.DrawLine BAR_WIDTH + 12 - nIdx, nIdx, BAR_WIDTH + 12 - nIdx, 7 - nIdx
Next
Set imgBar2.Picture = DIB.Picture
End Sub
Last edited by dreammanor; May 26th, 2020 at 06:36 AM.
...when the program runs to RC5.DC.DrawLine, VB6-IDE will make an error and exit. I don't know why.
Fixed that in the new (already uploaded) version ...
This was "messed up by me" by passing a NullPointer in the last param of the GDI-MoveToEx-API as 0&, instead of ByVal 0& ...
(since this worked "some looong time ago", I assume that I redefined the API-Declare at some point - without adapting the call)
Originally Posted by dreammanor
Question 047: About RC5.cDC.DrawLine
I know RC5.Cairo is a good choice, but Cairo does not seem to be too convenient when dealing with single pixels.
So I plan to use RC5.Win32_DC as my drawing tool to replace wqweto's cMemDC.
I wouldn't invest this time in your shoes, because:
- "GDI-API-knowledge" will not help you with anything in the future
- nor will the Code you're about to write be portable to other platforms
- and ensuring DPI-awareness for all that GDI-based code is also "an adventure"
If you'd use the RC5-WidgetEngine instead to build that Dialogue:
- you'd end up with significantly less code
- learn cairo along the way
- all the while developing fully DPI-aware (without doing anything special for it)
- ending up with a contribution to the RC5-WidgetSet
- the new ColorChooser-widget then e.g. usable in a portable new IDE (saving time on my end)
As for convenient Pixel-access on a Cairo-Surface - this can be achieved via "virtual SafeArray-spanning":
Dim Pxl2D() As Byte
CC.Surface.BindToArray Pxl2D
'... Pixel-Loop here
CC.Surface.ReleaseArray Pxl2D
But you'll probably not need this, when you apply Linear-Gradient-Patterns properly.
FWIW, below is your changed Form-Code (to show, how the two triangles can be drawn with RC5.Cairo in a "best-practice"-way).
Code:
Option Explicit
Private Const BAR_WIDTH As Long = 16, MASK_COLOR As Long = &HFF00FF
Private Sub Command1_Click()
DrawBarSelector_wqweto BAR_WIDTH + 13, 7
End Sub
Private Sub Command2_Click()
DrawBarSelector_RC5_Win32 New_c.DIB(BAR_WIDTH + 13, 7)
End Sub
Private Sub Command3_Click()
DrawBarSelector_RC5_Cairo Cairo.CreateSurface(BAR_WIDTH + 13, 7).CreateContext
End Sub
'--- draw bar selector with RC5_Cairo ---
Private Sub DrawBarSelector_RC5_Cairo(CC As cCairoContext)
CC.Paint 1, Cairo.CreateSolidPatternLng(Me.BackColor) 'CC.Paint will fill the whole surface (no need to define a Rect)
DefineTrianglePathOn CC, CC.Surface.Height / 2 'we pass the y-extent of the diagonal (as half the Surface-Height)
CC.TranslateDrawings CC.Surface.Width, 0 'translate, so the second triangle will be drawn "from the top-right-edge"
CC.ScaleDrawings -1, 1 'we just have to flip the x-Axis-Scaling in addition, for "inverse expansion"
DefineTrianglePathOn CC, CC.Surface.Height / 2 'now we add the same path-coords again (but under the just defined coord-transform)
CC.Fill , Cairo.CreateSolidPatternLng(vbBlack) 'to finally fill both path-defs of our two triangles in one call
Set imgBar3.Picture = CC.Surface.Picture
End Sub
Private Sub DefineTrianglePathOn(CC As cCairoContext, DExt As Double)
CC.MoveTo 0, 0 'define (move-to) the top-left-origin of our triangle
CC.RelLineTo DExt, DExt 'a diagonal, relative from the origin (ending in the y-center)
CC.RelLineTo -DExt, DExt 'and the same diagonal, relative-backwards (inverted in x-direction)
End Sub
'--- draw bar selector in mem dc ---
Private Sub DrawBarSelector_wqweto(ByVal dx As Long, ByVal dy As Long)
With New cMemDC
.Init dx, dy
.Cls MASK_COLOR
Dim nIdx As Long
For nIdx = 0 To dy \ 2
.DrawLine nIdx, nIdx, nIdx, dy - nIdx
.DrawLine dx - nIdx - 1, nIdx, dx - nIdx - 1, dy - nIdx
Next
Set imgBar.Picture = .ExtractIcon(MASK_COLOR)
End With
End Sub
'--- draw bar selector with RC5_Win32_DC ---
Private Sub DrawBarSelector_RC5_Win32(DIB As cDIB)
DIB.Fill Me.BackColor 'ensure a BackGround-Fill on the complete DIB-area
With New_c.DC(DIB) 'create a DC-instance (using the Constructor, to select the DIB)
Dim nIdx As Long
For nIdx = 0 To DIB.dy \ 2
.DrawLine nIdx, nIdx, nIdx, DIB.dy - nIdx
.DrawLine DIB.dx - nIdx - 1, nIdx, DIB.dx - nIdx - 1, DIB.dy - nIdx
Next
End With
Set imgBar2.Picture = DIB.Picture
End Sub
Re: The 1001 questions about vbRichClient5 (2020-05-26)
Hi Olaf, thank you for your detailed reply. Your solution is excellent as always. Much appreciated.
Actually, I've used RC5.Cairo to develop several controls before, such as Spread, RichEdit (CodeEditor), ScrollBar. But my memory is very poor now, as long as I haven't used RC5.Cairo for 6 months, I'll completely forget Cario commands and syntax (however, I always seem to remember the GDI functions and syntax). Now I need to learn Cairo from scratch.
I decided to accept your suggestion and use RC5.Cairo instead of RC5.Win32DC, although this will kill many of my brain cells. In addition, I plan to record this "rewriting process" in detail and upload it to CodeBank for others to learn and refer to.
Edit:
The development of ColorPicker will be delayed for several weeks.
Last edited by dreammanor; May 31st, 2020 at 09:41 AM.
I know that there is HoverColor (HoverBackColor) property in cWidgetBase, but in many cases we still need HoverTextColor. It would be great if HoverTextColor could be added to cWidgetBase and enmThemeColor.
Question 049: Is there any possibility that Cairo and SqliteDB in RC5 will be banned?
Question 049: Is there any possibility that Cairo and SqliteDB in RC5 will be banned?
Last month, several military-related universities in China have been banned from using MATLAB because they have entered the sanctions list of the US government. I'm wondering whether Cairo and SqliteDB in vbRichClient5 have the possibility of being banned. Thanks.
Note:
The software developer/supplier of MATLAB is the American company MathWorks.
Re: Question 049: Is there any possibility that Cairo and SqliteDB in RC5 will be ban
Originally Posted by dreammanor
Question 049: Is there any possibility that Cairo and SqliteDB in RC5 will be banned?
Last month, several military-related universities in China have been banned from using MATLAB because they have entered the sanctions list of the US government. I'm wondering whether Cairo and SqliteDB in vbRichClient5 have the possibility of being banned. Thanks.
Note:
The software developer/supplier of MATLAB is the American company MathWorks.
Not sure, whether this is really a question, or a statement instead (to let us know, that MatLab "blocked chinese military institutions from using their services").
As for RC5 (and the binaries I provide) - I'll not hinder anyone to download new(er) versions of the libs I compile (from my WebServer, which is located in germany).
Also, it is "just a few Dlls in a Zip" - and not an (interactive) WebService you are using, so - once you've "downloaded it locally", nobody can take it from you there.
As for the situation with MatLab, I'd not blame the company itself (who's just following "the current law" of the state it is located in).
If the relations between china and germany should ever deteriorate to such a level or lower...,
I guess that "such banning" would happen at "german inet-provider-level" automatically (vbRichClient.com then not reachable anymore from chinese IP-addresses) -
all that without me "doing anything pro-actively, trying to be patriotic"...
Also keep in mind, that in such a "fictional deteriorated situation", the chinese would be good advised, to not use any pre-compiled binaries which came from "foreign Webservers or OSes"...
Re: Question 049: Is there any possibility that Cairo and SqliteDB in RC5 will be ban
Hi Olaf, thank you for your detailed reply. A few years ago, I started to try to gradually get rid of Microsoft's development environment. My computers now don't have MS-Office and VisualStudio.NET. Even my VB6 apps no longer use MsCommonControls, but it seems that I cannot find a suitable VB6 alternative. The prerequisite for me to be able to develop complex applications is to have an excellent "debugger", but apart from Delphi and VS.NET, I've never found a more friendly debugging environment than VB6. This is why I tried to develop a debugger for JavaScript with VB6 a few months ago.
12 years ago, I spent a lot of time looking for alternatives to Ms-AccessDB, and finally I found SqliteDB (dhRichClient30). Now, I have to start looking for alternatives to VB6.
Question 050: The best way to make ucPanel transparent
Question 050: The best way to make ucPanel transparent
In most cases, I use ucPanel as a container for RC5.Widgets. Now, I need to make the ucPanel transparent. I know there are several ways to achieve this. But I'd like to know what is the best way to make ucPanel transparent? Thanks.
Last edited by dreammanor; Jul 21st, 2020 at 11:48 AM.