diff --git a/comp/src/gb.gui.base/.project b/comp/src/gb.gui.base/.project index 9446c97dd..c9655b683 100644 --- a/comp/src/gb.gui.base/.project +++ b/comp/src/gb.gui.base/.project @@ -1,6 +1,6 @@ # Gambas Project File 3.0 Title=Common controls and classes for GUI components -Startup=FMain +Startup=TestMessage Icon=.hidden/window.png Version=3.16.90 VersionFile=1 @@ -8,7 +8,7 @@ Component=gb.image Component=gb.gui Component=gb.settings Arguments=[["-style=oxygen"],["-style=qtcurve"]] -Environment="GB_REVERSE=1\nGB_JIT_DEBUG=1\nGB_GUI=gb.qt5\nLIBOVERLAY_SCROLLBAR=0\n GTK_DEBUG=interactive" +Environment="GB_JIT_DEBUG=1\nGB_GUI=gb.qt5\nLIBOVERLAY_SCROLLBAR=0\n GTK_DEBUG=interactive" TabSize=2 Translate=1 Language=en diff --git a/comp/src/gb.gui.base/.src/Message/FMessage.class b/comp/src/gb.gui.base/.src/Message/FMessage.class index 85627b033..d6783a130 100644 --- a/comp/src/gb.gui.base/.src/Message/FMessage.class +++ b/comp/src/gb.gui.base/.src/Message/FMessage.class @@ -101,7 +101,7 @@ Public Sub Display(sIcon As String, sText As String, aButton As String[], aDefau 'hButton.Foreground = Color.TextBackground Endif hButton.Cancel = True - hButton.SetFocus + If Not Message.DefaultButton Then hButton.SetFocus Else If I = 0 Then If Message.ColoredButtons And If aButton.Count >= 2 Then If Application.DarkTheme Then @@ -111,6 +111,10 @@ Public Sub Display(sIcon As String, sText As String, aButton As String[], aDefau Endif 'hButton.Foreground = Color.TextBackground Endif + If Message.DefaultButton Then + hButton.Default = True + hButton.SetFocus + Endif Endif Next hSpace = New Spring(panButton) diff --git a/comp/src/gb.gui.base/.src/Message/Message.class b/comp/src/gb.gui.base/.src/Message/Message.class index d5c50fb2c..02cbcb040 100644 --- a/comp/src/gb.gui.base/.src/Message/Message.class +++ b/comp/src/gb.gui.base/.src/Message/Message.class @@ -5,29 +5,10 @@ Export Static Property Title As String Use $sTitle Static Property Style As String Static Property ColoredButtons As Boolean Use $bUseColor +Static Property DefaultButton As Boolean Use $bDefault = True Static Private $sStyle As String -'Export -' GB_DESC CMessageDesc[] = -' { -' GB_DECLARE("Message", 0), GB_VIRTUAL_CLASS(), -' -' GB_STATIC_METHOD("_exit", NULL, CMESSAGE_exit, NULL), -' -' GB_STATIC_METHOD("_call", "i", CMESSAGE_info, "(Message)s[(Button)s]"), -' GB_STATIC_METHOD("Info", "i", CMESSAGE_info, "(Message)s[(Button)s]"), -' GB_STATIC_METHOD("Warning", "i", CMESSAGE_warning, "(Message)s[(Button1)s(Button2)s(Button3)s]"), -' GB_STATIC_METHOD("Question", "i", CMESSAGE_question, "(Message)s[(Button1)s(Button2)s(Button3)s]"), -' GB_STATIC_METHOD("Error", "i", CMESSAGE_error, "(Message)s[(Button1)s(Button2)s(Button3)s]"), -' GB_STATIC_METHOD("Delete", "i", CMESSAGE_delete, "(Message)s[(Button1)s(Button2)s(Button3)s]"), -' -' GB_STATIC_PROPERTY("Title", "s", CMESSAGE_title), -' -' GB_END_DECLARE -' }; -' - Static Public Sub _call((Message) As String, Optional Button As String) As Integer Return Info(Message, Button) diff --git a/comp/src/gb.gui.base/.src/Test/TestMessage.module b/comp/src/gb.gui.base/.src/Test/TestMessage.module index 6e7f930dc..1485e790e 100644 --- a/comp/src/gb.gui.base/.src/Test/TestMessage.module +++ b/comp/src/gb.gui.base/.src/Test/TestMessage.module @@ -5,8 +5,8 @@ Use "gb.form.stock" Public Sub Main() - ' Print Message.Question("Ceci est un message d'avertissement dont le texte est tout spécialement long afin de tester la boite de dialogue. Toutes les modifications non enregistrées seront perdues !", "Sauvegarder", "Envoyer", "Annuler") - Message("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12") + Print Message.Question("Ceci est un message d'avertissement dont le texte est tout spécialement long afin de tester la boite de dialogue. Toutes les modifications non enregistrées seront perdues !", "Sauvegarder", "Envoyer", "Annuler") + 'Message("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12") Return Dim p As String