Form editor: Do not crash if a control in "_Similar" does not exist, and fix the coherency test on "_DrawWith" property.

[DEVELOPMENT ENVIRONMENT]
* BUG: Form editor: Do not crash if a control in "_Similar" does not exist.
* BUG: Form editor: Fix the coherency test on "_DrawWith" property.
This commit is contained in:
gambas 2021-05-25 22:40:05 +02:00
parent 0bf8f99f28
commit 8cf76955ff
2 changed files with 20 additions and 3 deletions

View file

@ -438,6 +438,7 @@ Public Sub GetSimilars() As String[]
For Each sSimilar In cSimilar
hClass = Project.Documentation.Classes[cSimilar.Key]
If Not hClass Then Continue
If hClass.IsDeprecated() And If Not FToolBox.IsDeprecatedVisible() Then Continue
aSimilar.Add(cSimilar.Key)
Next

View file

@ -142,6 +142,15 @@ Static Public Sub GetIcon(sClass As String, sComp As String, Optional iSize As I
End
Private Sub IsContainerClass(hClass As Class) As Boolean
If hClass.Name = "Container" Then Return True
If Not hClass.Parent Then Return
Return IsContainerClass(hClass.Parent)
End
Private Function CreateControl(sName As String, sClass As String, hParent As Object) As Object
Dim hCtrl As Object
@ -164,11 +173,18 @@ Private Function CreateControl(sName As String, sClass As String, hParent As Obj
Endif
NoParent = Not hClass.ConstructorNeedParent()
hClassDraw = Project.Documentation.Classes[sClass]
If IsMultiContainer() Then
If Not hClassDraw.MultiContainer Then sClass = "TabPanel"
If sClass <> "TabPanel" And If sClass <> "TabStrip" Then
hClassDraw = Project.Documentation.Classes[sClass]
If Not hClassDraw Or If Not hClassDraw.MultiContainer Then sClass = "TabPanel"
Endif
Else If IsContainer() Then
If Not hClassDraw.Container Then sClass = "Panel"
If Class.IsLoaded(sClass) Then
If Not IsContainerClass(Classes[sClass]) Then sClass = "Panel"
Else
hClassDraw = Project.Documentation.Classes[sClass]
If Not hClassDraw Or If Not hClassDraw.Container Then sClass = "Panel"
Endif
Endif
Select Case LCase(sClass)