Message: Rework the message box. Copying the message is now done through a popup menu.

[GB.GUI.BASE]
* NEW: Message: Rework the message box. Copying the message is now done through a popup menu.
* OPT: ScrollArea: Remove some useless lines in scrollbar management.
This commit is contained in:
gambas 2020-11-24 21:50:24 +01:00
parent 27afeb5904
commit 5a5e468866
6 changed files with 50 additions and 47 deletions

View File

@ -1,13 +1,13 @@
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FPaint
Startup=Main
Version=3.15.90
VersionFile=1
Component=gb.image
Component=gb.gui
Component=gb.settings
ArgumentList=[["-style=oxygen"],["-style=qtcurve"]]
Environment="GB_JIT_DEBUG=1\nGB_GUI=gb.gtk3\nLIBOVERLAY_SCROLLBAR=0"
Environment="GB_JIT_DEBUG=1\nGB_GUI=gb.gtk3\nLIBOVERLAY_SCROLLBAR=0\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en

View File

@ -417,8 +417,6 @@ Public Sub ScrollArea_Draw()
Dim iBgSel As Integer
Dim iPadding As Integer
'Debug Me.Font.ToString();; Draw.Font.ToString()
If $iBg <> Color.Transparent Then
If $iBg = Color.Default Then
iBg = Color.TextBackground

View File

@ -33,15 +33,9 @@
Public Sub Main()
' Dim hImage As Image
'
' hImage = New Image(256, 256, Color.Transparent)
' Paint.Begin(hImage)
' Paint.Background = Color.Red
' Paint.Cross(16, 16, 224, 224, 64)
' Paint.Fill
' Paint.End
' hImage.Save("~/test.png")
Component.Load("gb.form")
'Message.Question("Ceci est un très long message qui doit permettre de tester la nouvelle disposition des boutons des boites de dialogues affichant des messages.", "Oui", "Non", "Peut-être")
Message.Question("Ceci est un message.") ', "Oui", "Non", "Peut-être")
End

View File

@ -4,6 +4,7 @@ Static Private $iButton As Integer
Public Sub Run(sIcon As String, sText As String, aButton As String[]) As Integer
Dim DS As Integer = Desktop.Scale
Dim sTitle As String
Dim hPict As Picture
Dim H As Integer
@ -13,6 +14,7 @@ Public Sub Run(sIcon As String, sText As String, aButton As String[]) As Integer
Dim iBusy As Integer
Dim WB As Integer
Dim HT As Integer
Dim hSpace As Spring
sTitle = Message.Title
If Not sTitle Then sTitle = Application.Title
@ -33,14 +35,10 @@ Public Sub Run(sIcon As String, sText As String, aButton As String[]) As Integer
If Not hPict Then hPict = Picture["./gb.gui.base/message/info.png"]
picMessage.Picture = hPict
hPict = Picture["icon:/small/copy"]
If Not hPict Then hPict = Picture["./gb.gui.base/message/copy.png"]
btnCopy.Picture = hPict
sText = Replace(sText, "\n", "<br>")
txtMessage.Ignore = True
txtMessage.W = Screen.AvailableWidth \ 3
txtMessage.W = Screen.AvailableWidth \ 4
txtMessage.Text = sText
txtMessage.Adjust
HT = txtMessage.H
@ -51,16 +49,17 @@ Public Sub Run(sIcon As String, sText As String, aButton As String[]) As Integer
hButton = New Button(panButton) As "Button"
hButton.Tag = I
hButton.Text = aButton[I]
hButton.W = Max(Desktop.Scale * 14, hButton.Font.TextWidth(hButton.Text) + Desktop.Scale * 2)
hButton.W = Max(DS * 14, hButton.Font.TextWidth(hButton.Text) + DS * 2)
H = Max(H, hButton.Font.TextHeight(hButton.Text))
WB += hButton.W + Desktop.Scale
WB += hButton.W + DS
If I = 0 Then hButton.SetFocus()
If I = aButton.Max Then hButton.Cancel = True
Next
panButton.H = Max(H, Desktop.Scale * 4)
hSpace = New Spring(panButton)
panButton.H = Max(H, DS * 4)
W = Max(txtMessage.W + 1, WB) + picMessage.W + Desktop.Scale * 4
H = Max(Desktop.Scale * 8, HT) + panButton.H + Desktop.Scale * 5
W = Max(DS * 32, Max(txtMessage.W + 1, WB) + picMessage.W + DS * 4)
H = Max(DS * 8, HT) + panButton.H + DS * 5
Me.Resize(W, H)
@ -98,9 +97,10 @@ Public Sub Form_KeyPress()
End
Public Sub btnCopy_Click()
Public Sub mnuCopy_Click()
Component.Load("gb.util")
Clipboard.Copy(String.FromHTML(txtMessage.Text))
End

View File

@ -1,37 +1,49 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,64,18)
MoveScaled(0,0,69,31)
Resizable = False
Arrangement = Arrange.Vertical
Margin = True
{ mnuPopup Menu
Text = ("Menu1")
Visible = False
{ mnuCopy Menu
Text = ("Copy message")
Shortcut = "Ctrl+C"
}
}
{ panMessage HBox
MoveScaled(1,1,58,8)
MoveScaled(1,1,65,20)
Expand = True
{ Panel3 Panel
MoveScaled(0,0,8,9)
MoveScaled(1,1,8,17)
{ picMessage PictureBox
MoveScaled(0,0,8,8)
Mode = PictureBox.Fill
}
}
{ Panel2 Panel
MoveScaled(10,2,2,4)
MoveScaled(10,2,1,4)
}
{ txtMessage TextLabel
MoveScaled(16,0,41,4)
{ Panel4 VBox
MoveScaled(14,1,43,18)
Expand = True
PopupMenu = "mnuPopup"
{ txtMessage TextLabel
MoveScaled(1,1,41,4)
Expand = True
}
}
}
{ Panel5 Panel
MoveScaled(30,22,7,2)
}
{ panButton HBox
MoveScaled(1,13,62,4)
MoveScaled(11,25,37,4)
Spacing = True
{ btnCopy ToolButton
MoveScaled(2,0,4,4)
ToolTip = ("Copy message")
}
{ Panel1 Panel
MoveScaled(9,0,4,4)
MoveScaled(2,0,4,4)
Expand = True
}
}

View File

@ -190,13 +190,12 @@ RETRY:
W = Me.Width - FW * 2
H = Me.Height - FW * 2
'Debug W;; H;; "/";; $W;; $H;; bHBarAllowed;; bVBarAllowed
If W >= $W And If H >= $H Then
$hHBar.MinValue = 0
'$hHBar.MinValue = 0
$hHBar.MaxValue = 0
$hVBar.MinValue = 0
'$hVBar.MinValue = 0
$hVBar.MaxValue = 0
'$hHBar.Hide
'$hVBar.Hide
@ -205,10 +204,10 @@ RETRY:
Else If bHBarAllowed And If $W > W And If $H <= (H - SB - SP) Then
$hHBar.MinValue = 0
'$hHBar.MinValue = 0
$hHBar.MaxValue = $W - W
$hHBar.PageStep = W
$hVBar.MinValue = 0
'$hVBar.MinValue = 0
$hVBar.MaxValue = 0
'$hHBar.Show
'$hVBar.Hide
@ -217,10 +216,10 @@ RETRY:
Else If bVBarAllowed And If $H > H And If $W <= (W - SB - SP) Then
$hVBar.MinValue = 0
'$hVBar.MinValue = 0
$hVBar.MaxValue = $H - H
$hVBar.PageStep = H
$hHBar.MinValue = 0
'$hHBar.MinValue = 0
$hHBar.MaxValue = 0
'$hHBar.Hide
'$hVBar.Show
@ -229,7 +228,7 @@ RETRY:
Else
$hHBar.MinValue = 0
'$hHBar.MinValue = 0
If bVBarAllowed Then
P = W - SB - SP
Else
@ -242,12 +241,12 @@ RETRY:
bHBarVisible = bHBarAllowed
Else
'$hHBar.Hide
$hHBar.MinValue = 0
'$hHBar.MinValue = 0
$hHBar.MaxValue = 0
bHBarVisible = False
Endif
$hVBar.MinValue = 0
'$hVBar.MinValue = 0
If bHBarAllowed Then
P = H - SB - SP
Else
@ -260,7 +259,7 @@ RETRY:
bVBarVisible = bVBarAllowed
Else
'$hVBar.Hide
$hVBar.MinValue = 0
'$hVBar.MinValue = 0
$hVBar.MaxValue = 0
bVBarVisible = False
Endif