problem with different desktop environments?

Post

Posted
Rating:
#1 (In Topic #459)
Trainee
 Two questions:
I use a gambas exe in different environments. There seems to be a problem with the component library:
- When I use deb 10 & gb.gtk3 I have a segmentation fault
- When I use deb 10 & gb.gui, no problems
- When I use deb 11 & gnome3 - the exe does not work properly (messagebox does not show properly, cannot click on buttons etc.)
- When I switch to xfce3 & gdm, everything seems normal though I did not test it properly. (all code tested using the ide)
Would this cause problems in the long run, like when distributions upgrade libraries?

deb 10 & gb.gui:
I have a combobox that does not catch backspace and delete keys though it does everything else (trying to select text as user types).

Public Sub cmb_Observer_KeyPress() '' Listener for searching in the combo
  Dim $ww, $w1 As String
  Dim $qa As Integer
  Dim $qCount As Integer

 ' problem here  vvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  If Key.Code = Key.BackSpace Or Key.Code = Key.Delete Then
    searchStr = ""
    Me.Text = ""
    Return
  Endif
 
  If Key.Code = Key.ShiftKey Or Key.Code = Key.Down Or Key.Code = Key.Up Then Return
  If (Key.Code = Key.Return Or Key.Code = Key.Enter) Then
    Raise ntExec()
    searchStr = ""
    Stop Event
    Return
  Endif
  searchStr &= Key.Text
  If Len(searchStr) = 1 Then searchStr = Upper(Left(searchStr)) & Right(searchStr, -1)
  For Each $ww In Me.List
    If String.Left($ww, Len(searchStr)) = searchStr Then
      Me.Text = $ww
      Stop Event
      Return
    Else
    Endif
  Next
  
  
  Stop Event
End
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Question 1: - Does Debian 10 have gtk3? Use gb.gui so Gambas can pick the one it needs. You don't say which 'gb.' you are using in Debian 11 with Gnome.

Question 2: Interesting. It seems that the Gambas code for GTK does not see the Delete or Backspace keys when using KeyPress(). It does see it if you use KeyRelease(). If you use gb.gui.qt then KeyPress() does see the Delete and Backspace keys.

Your code looks quite complex, try running the following in a new Graphical Application.

Code (gambas)

  1. ComboBox1 As ComboBox
  2.  
  3. Public Sub Form_Open()
  4.  
  5.   With ComboBox1 = New ComboBox(Me) As "ComboBox1"
  6.     .Width = Me.Width
  7.     .Height = 28
  8.     .y = 20
  9.  
  10.  
  11. Public Sub ComboBox1_KeyRelease()
  12.  
  13.   If Key.Code = Key.Delete Then
  14.     Print "Delete"
  15.   Else If Key.Code = Key.Backspace Then
  16.     Print "Backspace"
  17.   Else
  18.     Print Right(ComboBox1.Text)
  19.   End If
  20.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Trainee
 I'll respond about the exact problems with Debian 11.
As for the KeyRelease, it worked, thanks. Never thought to try that.
Online now: No Back to the top
1 guest and 0 members have just viewed this.