Form editor: Allow the 'DrawWith' control constant to define the initial value of properties of the control used for drawing.
[DEVELOPMENT ENVIRONMENT] * NEW: Form editor: Allow the 'DrawWith' control constant to define the initial value of properties of the control used for drawing.
This commit is contained in:
parent
44a540c9cc
commit
c7451f1086
1 changed files with 36 additions and 1 deletions
|
@ -160,6 +160,11 @@ Private Function CreateControl(sName As String, sClass As String, hParent As Obj
|
|||
Dim hWindow As Window
|
||||
Dim hClass As CClassInfo
|
||||
Dim hClassDraw As CClassInfo
|
||||
Dim iPos As Integer
|
||||
Dim aInit As String[]
|
||||
Dim sInit As String
|
||||
Dim hProp As CPropertyInfo
|
||||
Dim sProp As String
|
||||
|
||||
'PRINT "> CreateControl "; sClass
|
||||
|
||||
|
@ -169,7 +174,14 @@ Private Function CreateControl(sName As String, sClass As String, hParent As Obj
|
|||
bExist = hClass <> Null
|
||||
If bExist Then
|
||||
DrawWith = hClass.DrawWith
|
||||
If DrawWith Then sClass = DrawWith
|
||||
If DrawWith Then
|
||||
sClass = DrawWith
|
||||
iPos = InStr(sClass, ":")
|
||||
If iPos Then
|
||||
aInit = Split(Mid$(sClass, iPos + 1))
|
||||
sClass = Left(sClass, iPos - 1)
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
NoParent = Not hClass.ConstructorNeedParent()
|
||||
|
||||
|
@ -315,6 +327,29 @@ Private Function CreateControl(sName As String, sClass As String, hParent As Obj
|
|||
|
||||
End Select
|
||||
|
||||
If aInit Then
|
||||
|
||||
For Each sInit In aInit
|
||||
|
||||
iPos = InStr(sInit, "=")
|
||||
If iPos = 0 Then Continue
|
||||
|
||||
sProp = Left(sInit, iPos - 1)
|
||||
With Project.Documentation.Classes[Kind]
|
||||
Try hProp = .Properties[sProp]
|
||||
If IsNull(hProp) Then Continue
|
||||
End With
|
||||
|
||||
If Len(hProp.Type) = 1 Then
|
||||
Try Object.SetProperty(hCtrl, sProp, Eval(Mid$(sInit, iPos + 1)))
|
||||
Else
|
||||
Try Object.SetProperty(hCtrl, sProp, GetRealValue(hProp, Mid$(sInit, iPos + 1)))
|
||||
Endif
|
||||
|
||||
Next
|
||||
|
||||
Endif
|
||||
|
||||
'PRINT "< CreateControl "; sClass
|
||||
|
||||
'IF hCtrl IS UserControl OR NOT hCtrl IS Container THEN
|
||||
|
|
Loading…
Reference in a new issue