[Gambas-user] DBus documentation mistake

Gianluigi bagonergi at ...626...
Thu Nov 17 21:09:42 CET 2016


I refer to the example of the documentation of DBusConnection.Register
(gb.dbus) [0]
unfortunately you can not get the reference to the project as previously:

Print DBus ["org.gambas.MyProject"] ["/ MyDBusClass"]. Compute (3, 4)

but you need to obtain the full name comprehensive of ID, using the
Honsek's trick of the German website of Gambas programmers, namely:

----------Start code
Private $sApplicationName As String

Public Sub Main()

  Dim aList As String[]
  Dim i As Integer
  ' HonseK trick
  aList = DBus.Session.Applications.Sort(gb.Descent)
  For i = 0 To aList.Max
    If aList[i] Begins "org.gambas.MyProject-" Then
      $sApplicationName = aList[i]
    Endif
  Next
  If Not IsNull($sApplicationName) Then
    Print "Result from MyDBusClass = ";
DBus[$sApplicationName]["/MyDBusClass"].Compute(3, 4);
  Endif
------------end code

[0] http://gambaswiki.org/wiki/comp/gb.dbus/dbusconnection/register



More information about the User mailing list