problem with different desktop environments?

Post Reply
salihburhan
Posts: 14
Joined: Thursday 24th October 2019 2:14pm

problem with different desktop environments?

Post by salihburhan » Wednesday 16th September 2020 11:09am

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

User avatar
cogier
Site Admin
Posts: 507
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: problem with different desktop environments?

Post by cogier » Wednesday 16th September 2020 4:35pm

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.
ComboBox1 As ComboBox

Public Sub Form_Open()

  With ComboBox1 = New ComboBox(Me) As "ComboBox1"
    .Width = Me.Width
    .Height = 28
    .y = 20
  End With

End

Public Sub ComboBox1_KeyRelease()

  If Key.Code = Key.Delete Then
    Print "Delete"
  Else If Key.Code = Key.Backspace Then
    Print "Backspace"
  Else
    Print Right(ComboBox1.Text)
  End If

End

salihburhan
Posts: 14
Joined: Thursday 24th October 2019 2:14pm

Re: problem with different desktop environments?

Post by salihburhan » Thursday 17th September 2020 6:45am

I'll respond about the exact problems with Debian 11.
As for the KeyRelease, it worked, thanks. Never thought to try that.

Post Reply