Hi all

I want to tell mypanel works well, but I want to improve.

The update of the open windows I do by a TIMER, but I would like to do it
directly X11, someone who can help me please.

Upgrading windows open is through a TIMER, but I would like to do it
directly gb.desktop.x11, someone who can help me please.

Attached is an example of my panel.


''CODE
Public id_win_active As Integer
Public HPanel_app As Panel
Public hToggle As ToggleButton


Public Sub Form_Open()

  Dim desk_w As Integer = Desktop.W

  X11.SetWindowProperty(Atom["_NET_WM_STRUT"], Atom["CARDINAL"], [0, 0, 0,
32], Me.Id)
  X11.SetWindowProperty(Atom["_NET_WM_STRUT_PARTIAL"], Atom["CARDINAL"],
[0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 32, desk_w], Me.Id)
  X11.SetWindowProperty(Atom["_NET_WM_WINDOW_TYPE"], Atom["ATOM"],
Atom["_NET_WM_WINDOW_TYPE_DOCK"], Me.Id)

  Me.X = 0
  Me.Y = Desktop.H - Me.H
  Me.W = Desktop.W

  Desktop_Windows
  Timer1.Start
  TimTask.Start

End

Public Sub Desktop_Windows()

  Dim i As Integer

  For i = 0 To Desktop.Windows.Count - 1
    If Desktop.Windows[i].Name Then
      hToggle = New ToggleButton(PanelTask) As "ToggleTask"

      Try hToggle.Picture = Desktop.Windows[i].Icon.Stretch(22, 22).Picture
      hToggle.Text = Left$(Desktop.Windows[i].Name, 25)
      hToggle.Height = 32
      'hToggle.Font.Size = 8
      hToggle.Mouse = 13
      hToggle.Border = True
      hToggle.W = 250
      hToggle.Tooltip = Desktop.Windows[i].Name
      hToggle.Tag = Desktop.Windows[i].Id

      If Not hToggle.Text Then
        hToggle.Text = "Sin título"
        hToggle.W = 250
      Endif

      If Not hToggle.Text Then
        hToggle.Text = ("Untitled")
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif

      If (hToggle.Picture = Picture[Null]) Then
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif

    Endif
  Next

End

Public Sub ToggleTask_Click()

  Try id_win_active = Last.Tag
  Try Desktop.ActiveWindow = id_win_active
  Try Desktop.Windows.FromHandle(id_win_active).Minimized =
Desktop.ActiveWindow = id_win_active

End

Public Sub Timer1_Timer()

  Dim x As String

  Timer1.Delay = 1000
  Timer1.Start

  x = Format$(Now, "hh:nn")
  TextLabelDate.Text = x

End

Public Sub Refresh_Taskbar() ''is not the best but it works

  Dim i As Integer

  Desktop.Windows.Refresh()
  If (PanelTask.Children.Count - (Desktop.Windows.Count - 2)) Then
    PanelTask.Children.Clear()
    For i = 1 To Desktop.Windows.Count - 2
      hToggle = New ToggleButton(PanelTask) As "ToggleTask"
      hToggle.W = 250
      Try hToggle.Picture = Desktop.Windows[i].Icon.Stretch(22, 22).Picture
      hToggle.Text = Left$(Desktop.Windows[i].Name, 25)
      hToggle.Height = 32

      hToggle.Mouse = 13
      hToggle.Tooltip = Desktop.Windows[i].Name
      hToggle.Tag = Desktop.Windows[i].Id

      If Not hToggle.Text Then
        hToggle.Text = ("Untitled")
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif
      If (hToggle.Picture = Picture[Null]) Then
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif

      Try hToggle.Visible = Not CBool(Desktop.Windows[i].SkipTaskbar)

    Next
  Else

    For Each hToggle In PanelTask.Children
      hToggle.Text = Left$(Desktop.Windows.FromHandle(hToggle.Tag).Name, 25)
      If Not hToggle.Text Then
        hToggle.Text = ("Untitled")
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif
      If (hToggle.Picture = Picture[Null]) Then
        hToggle.Picture = Picture["icon:/22/apps/application-default-icon"]
        hToggle.W = 250
      Endif

    Next
  Endif

Catch

End

Public Sub TimTask_Timer()

  Refresh_Taskbar

End

Herberth Guzmán

Attachment: task-0.0.1.tar.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to