From e909d1ea5ac1a96f1ef85b0341909864735ae0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 30 Aug 2015 02:02:20 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * BUG: Fix behaviour of shortcut text properties having ampersands inside. [GB.GUI.BASE] * BUG: Fix behaviour of shortcut text properties having ampersands inside. git-svn-id: svn://localhost/gambas/trunk@7253 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.src/Editor/Form/CControl.class | 10 +++++++++- app/src/gambas3/.src/Editor/Form/FForm.class | 5 +++-- app/src/gambas3/.src/Editor/Form/FForm.form | 2 +- comp/src/gb.gui.base/.component | 2 +- comp/src/gb.gui.base/.project | 4 ++-- comp/src/gb.gui.base/.src/Shortcut.class | 12 +++++++----- comp/src/gb.gui.base/.startup | 2 +- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/src/gambas3/.src/Editor/Form/CControl.class b/app/src/gambas3/.src/Editor/Form/CControl.class index 31d9deea6..d99451c65 100644 --- a/app/src/gambas3/.src/Editor/Form/CControl.class +++ b/app/src/gambas3/.src/Editor/Form/CControl.class @@ -1635,7 +1635,15 @@ Public Function GetEachProperty(DX As Integer, DY As Integer, Optional bNoScale iPos = String.InStr(sVal, "&") If iPos Then sShortcut = String.Mid$(sVal, iPos + 1, 1) - sLine &= "Shortcut((" & Quote(String.Left(sVal, iPos - 1) & String.Mid$(sVal, iPos + 1)) & "), " & Quote(sShortcut) & ")" + If InStr("& ", sShortcut) Then + sShortcut = "" + Else + sVal = String.Left(sVal, iPos - 1) & String.Mid(sVal, iPos + 1) + Endif + Endif + + If sShortcut Then + sLine &= "Shortcut((" & Quote(sVal) & "), " & Quote(sShortcut) & ")" Else sLine &= "(" & Quote(sVal) & ")" Endif diff --git a/app/src/gambas3/.src/Editor/Form/FForm.class b/app/src/gambas3/.src/Editor/Form/FForm.class index c2e61adc5..72cd9e08d 100644 --- a/app/src/gambas3/.src/Editor/Form/FForm.class +++ b/app/src/gambas3/.src/Editor/Form/FForm.class @@ -408,8 +408,9 @@ Private Sub FromString(sData As String, Optional hParent As CControl) As String If InStr(sValue, "\\\"") Then Error "gambas3: "; File.Name(Path); ".form: "; sValue - aScan = Scan(Mid$(sValue, 10), "(*),*)*") - vValue = Shortcut(UnQuote(Trim(aScan[0])), UnQuote(Trim(aScan[1]))) + aScan = Scan(Mid$(sValue, 10), "(*)*)*") + + vValue = Shortcut(UnQuote(Trim(aScan[0])), UnQuote(Trim(Mid(aScan[1], 2)))) If aScan[2] Then vValue &= UnQuote(Trim(Mid$(Trim(aScan[2]), 2))) Else diff --git a/app/src/gambas3/.src/Editor/Form/FForm.form b/app/src/gambas3/.src/Editor/Form/FForm.form index 486d0a18c..7f75613e5 100644 --- a/app/src/gambas3/.src/Editor/Form/FForm.form +++ b/app/src/gambas3/.src/Editor/Form/FForm.form @@ -549,7 +549,7 @@ } } { svwWorkspace ScrollView - MoveScaled(2,14,58,39) + MoveScaled(3,14,58,39) Background = Color.LightForeground Expand = True Border = False diff --git a/comp/src/gb.gui.base/.component b/comp/src/gb.gui.base/.component index 8c75212da..b1a005e46 100644 --- a/comp/src/gb.gui.base/.component +++ b/comp/src/gb.gui.base/.component @@ -1,5 +1,5 @@ [Component] Key=gb.gui.base -Version=3.8.0 +Version=3.8.90 Hidden=True Needs=Form diff --git a/comp/src/gb.gui.base/.project b/comp/src/gb.gui.base/.project index f97f75c28..16a967086 100644 --- a/comp/src/gb.gui.base/.project +++ b/comp/src/gb.gui.base/.project @@ -1,8 +1,8 @@ # Gambas Project File 3.0 -# Compiled with Gambas 3.8.0 +# Compiled with Gambas 3.8.90 Title=gb.gui.base Startup=FGridView -Version=3.8.0 +Version=3.8.90 VersionFile=1 Component=gb.image Component=gb.gui diff --git a/comp/src/gb.gui.base/.src/Shortcut.class b/comp/src/gb.gui.base/.src/Shortcut.class index 92473c2e0..eb7838218 100644 --- a/comp/src/gb.gui.base/.src/Shortcut.class +++ b/comp/src/gb.gui.base/.src/Shortcut.class @@ -6,11 +6,13 @@ Static Public Sub _call(Text As String, Shortcut As String) As String Dim iPos As Integer - iPos = String.InStr(Text, "&") - If iPos Then - Shortcut = String.Mid$(Text, iPos + 1, 1) - Text = Left(Text, iPos - 1) & Mid$(Text, iPos + 1) - Endif + ' iPos = String.InStr(Text, "&") + ' If iPos Then + ' Shortcut = String.Mid$(Text, iPos + 1, 1) + ' Text = String.Left(Text, iPos - 1) & String.Mid$(Text, iPos + 1) + ' Endif + + If Not Shortcut Then Return Text iPos = InStr(Text, Shortcut, 1, gb.IgnoreCase) If iPos = 0 Then Return Text '& " (&" & String.UCase(Shortcut) & ")" diff --git a/comp/src/gb.gui.base/.startup b/comp/src/gb.gui.base/.startup index 7121404e8..627feff68 100644 --- a/comp/src/gb.gui.base/.startup +++ b/comp/src/gb.gui.base/.startup @@ -2,7 +2,7 @@ FGridView gb.gui.base 0 0 -3.8.0 +3.8.90 gb.image gb.gui