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.
This commit is contained in:
gambas 2021-06-28 19:32:26 +02:00
parent 0cd8bb60c8
commit 650dd0a018
3 changed files with 30 additions and 19 deletions

View file

@ -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

View file

@ -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

View file

@ -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()