From 650dd0a018d5a2062834dc3badf588bdb36916bb Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 28 Jun 2021 19:32:26 +0200 Subject: [PATCH] MenuButton: Fix GTK+3 warnings on hidden shortcut buttons. [GB.FORM] * BUG: MenuButton: Fix GTK+3 warnings on hidden shortcut buttons. * NEW: DirChooser & FileChooser: Do not use a Watcher to initialize the popup menu. --- comp/src/gb.form/.project | 4 +-- comp/src/gb.form/.src/Button/MenuButton.class | 13 ++++++-- .../.src/File/Chooser/FDirChooser.class | 32 +++++++++++-------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/comp/src/gb.form/.project b/comp/src/gb.form/.project index 3106818c5..5eeb5b2cb 100644 --- a/comp/src/gb.form/.project +++ b/comp/src/gb.form/.project @@ -1,6 +1,6 @@ # Gambas Project File 3.0 Title=More controls for graphical components -Startup=FTestTableView +Startup=FTestFileChooser Icon=.hidden/icon.png Version=3.16.90 VersionFile=1 @@ -10,7 +10,7 @@ Component=gb.form Component=gb.settings Component=gb.form.stock Authors="BenoƮt Minisini" -Environment="GB_GUI=gb.qt5\n GB_STOCK_DEBUG=1\n LANG=zh_CN.UTF-8\n LC_ALL=en_US.UTF-8\n LC_ALL=zh_CN.UTF-8\n GTK_DEBUG=interactive" +Environment="GB_GUI=gb.gtk3\n GB_STOCK_DEBUG=1\n LANG=zh_CN.UTF-8\n LC_ALL=en_US.UTF-8\n LC_ALL=zh_CN.UTF-8\n GTK_DEBUG=interactive" TabSize=2 Translate=1 Language=en diff --git a/comp/src/gb.form/.src/Button/MenuButton.class b/comp/src/gb.form/.src/Button/MenuButton.class index 8a69a77cf..89176f2d1 100644 --- a/comp/src/gb.form/.src/Button/MenuButton.class +++ b/comp/src/gb.form/.src/Button/MenuButton.class @@ -90,25 +90,32 @@ Private Sub Text_Write(Value As String) $iShortcutPos = 0 Do + iPos = String.InStr($sText, "&", iPos + 1) If iPos = 0 Then Break If String.Mid$($sText, iPos + 1, 1) = "&" Then Inc iPos Continue Endif + If Not $hButton Then $hButton = New Button(Me) As "Button" $hButton.Ignore = True $hButton.Border = False + $hButton.AutoResize = True 'S = Desktop.Scale * 3 - $hButton.Move(0, 0, 1, 1) $hButton.Lower() Endif + $hButton.Text = String.Mid$($sText, iPos, 2) $hButton.Enabled = Not Me.Design $iShortcutPos = iPos $sActualText = String.Left($sText, iPos - 1) & String.Mid($sText, iPos + 1) + + $hButton.Y = -$hButton.H + Break + Loop $sActualText = Replace($sActualText, "&&", "&") @@ -320,7 +327,7 @@ End Public Sub DrawingArea_GotFocus() - If $hButton Then $hButton.Enabled = False + If $hButton And If Not Me.Design Then $hButton.Enabled = False _SetLastFocus $hDrawingArea.Refresh @@ -328,7 +335,7 @@ End Public Sub DrawingArea_LostFocus() - If $hButton Then $hButton.Enabled = True + If $hButton And If Not Me.Design Then $hButton.Enabled = True $hDrawingArea.Refresh End diff --git a/comp/src/gb.form/.src/File/Chooser/FDirChooser.class b/comp/src/gb.form/.src/File/Chooser/FDirChooser.class index 47d92ca31..a11da84d9 100644 --- a/comp/src/gb.form/.src/File/Chooser/FDirChooser.class +++ b/comp/src/gb.form/.src/File/Chooser/FDirChooser.class @@ -33,7 +33,7 @@ Private $bFile As Boolean Private $hBookmarkList As CBookmarkList Private $hCurrentBookmark As CBookmark Private $bShowBookmark As Boolean -Private $hWatch As Watcher +'Private $hWatch As Watcher 'Private $bPressed As Boolean Private $sLast As String @@ -90,7 +90,7 @@ Public Sub _new(Optional bFile As Boolean) 'btnParent.Picture = Main.GetArrow(Align.Left, 16).Picture - $hWatch = New Watcher(fvwChoose) As "FileView" + '$hWatch = New Watcher(fvwChoose) As "FileView" FillMenu @@ -244,6 +244,9 @@ Private Sub UpdateView() btnDetail.Visible = $bView btnPreview.Visible = $bView + FillMenu + UpdateZoom + End Public Sub btnView_Click() @@ -1203,18 +1206,19 @@ Public Sub btnZoomIn_Click() End -Public Sub FileView_Show() - - FillMenu - UpdateZoom - -End - -Public Sub FileView_Hide() - - FileView_Show - -End +' Public Sub FileView_Show() +' +' Debug +' FillMenu +' UpdateZoom +' +' End +' +' Public Sub FileView_Hide() +' +' FileView_Show +' +' End Public Sub mnuRename_Click()