Color chooser dialog: Keep the last opened tab when the dialog is used for inserting a color.

[DEVELOPMENT ENVIRONMENT]
* NEW: Color chooser dialog: Keep the last opened tab when the dialog is used for inserting a color.
This commit is contained in:
gambas 2018-09-04 16:20:30 +02:00
parent a908cbcecd
commit 7e18d476ee
2 changed files with 17 additions and 2 deletions

View file

@ -4,6 +4,7 @@ Static Public (Color) As String
Static Public Value As Integer
Static Public Pattern As String
Static Private $bInsert As Boolean
Static Private $sColor As String
Static Private $bAlpha As Boolean
'Static Private $aDefaultColors As String[] = ["Background", "Foreground", "SelectedBackground", "SelectedForeground", "LightBackground", "LightForeground", "TextBackground", "TextForeground", "ButtonBackground", "ButtonForeground", "TooltipBackground", "TooltipForeground", "LinkForeground", "VisitedForeground"]
@ -48,6 +49,7 @@ End
Static Public Function Run(Optional sColor As String, Optional bAlpha As Boolean, Optional sTitle As String, Optional aPrefix As String[]) As Boolean
$bInsert = False
$sColor = sColor
$bAlpha = bAlpha
$sTitle = sTitle
@ -57,6 +59,19 @@ Static Public Function Run(Optional sColor As String, Optional bAlpha As Boolean
End
Static Public Sub Insert(bAlpha As Boolean, sTitle As String, aPrefix As String[]) As Boolean
$bInsert = True
$sColor = ""
$bAlpha = bAlpha
$sTitle = sTitle
$aPattern = aPrefix
Return Not FColorChooser.ShowModal()
End
Public Sub btnOK_Click()
@ -140,7 +155,7 @@ Public Sub Form_Open()
tabColor[0].Visible = False
Endif
tabColor.Index = iIndex
If Not $bInsert Then tabColor.Index = iIndex
dlgColor.ShowAlpha = $bAlpha

View file

@ -235,7 +235,7 @@ End
Public Sub Button_Click()
If FColorChooser.Run("", False, ("Insert color"), $aPattern) Then Return
If FColorChooser.Insert(False, ("Insert color"), $aPattern) Then Return
With GetEditor()
.Insert(FColorChooser.Pattern)