From e05dffd530a6bf0f04167b5bcd23802d24dea278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 26 Aug 2015 22:24:42 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * BUG: Color chooser does not crash anymore when the project does not use any GUI component. git-svn-id: svn://localhost/gambas/trunk@7243 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- .../gambas3/.src/Dialog/FColorChooser.class | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/app/src/gambas3/.src/Dialog/FColorChooser.class b/app/src/gambas3/.src/Dialog/FColorChooser.class index 318c269a6..036c7d6d8 100644 --- a/app/src/gambas3/.src/Dialog/FColorChooser.class +++ b/app/src/gambas3/.src/Dialog/FColorChooser.class @@ -80,30 +80,10 @@ Public Sub Form_Open() Dim hClass As CClassInfo Dim hSym As CSymbolInfo Dim sColor As String + Dim iIndex As Integer Settings.Read(Me) - $aColorName = New String[] - hClass = CComponent.Classes["Color"] - - For Each hSym In hClass.Symbols - sColor = hSym.Name - If sColor = "Default" Then Continue - If InStr("RC", hSym.Kind) And If hSym.Type = "i" And If Not $aColorName.Exist(sColor) Then - $aColorName.Add(sColor) - Endif - Next - - $aColorName.Sort() - - $aPict = New Picture[$aColorName.Count] - - gvwColor.Columns.Count = 2 - gvwColor.Mode = Select.Single - gvwColor.Columns[0].W = 24 - gvwColor.Columns[0].Alignment = Align.Center - gvwColor.Rows.Count = $aColorName.Count + 1 - cmbPrefix.List = $aPrefix If $aPrefix Then cmbPrefix.Show @@ -111,19 +91,51 @@ Public Sub Form_Open() cmbPrefix.Hide Endif + $aColorName = New String[] + + hClass = CComponent.Classes["Color"] + If hClass Then + + For Each hSym In hClass.Symbols + sColor = hSym.Name + If sColor = "Default" Then Continue + If InStr("RC", hSym.Kind) And If hSym.Type = "i" And If Not $aColorName.Exist(sColor) Then + $aColorName.Add(sColor) + Endif + Next + + $aColorName.Sort() + + $aPict = New Picture[$aColorName.Count] + + gvwColor.Columns.Count = 2 + gvwColor.Mode = Select.Single + gvwColor.Columns[0].W = 24 + gvwColor.Columns[0].Alignment = Align.Center + gvwColor.Rows.Count = $aColorName.Count + 1 + + Endif + If Not IsNull(Val($sColor)) Then gvwColor.Row = 0 dlgColor.SelectedColor = Val($sColor) - tabColor.Index = 1 + iIndex = 1 Else If $sColor Then gvwColor.Row = $aColorName.Find($sColor) + 1 Else gvwColor.Row = 0 Endif - tabColor.Index = 0 + iIndex = 0 Endif + If Not hClass Then + iIndex = 1 + tabColor[0].Visible = False + Endif + + tabColor.Index = iIndex + dlgColor.ShowAlpha = $bAlpha If $sTitle Then