2013-04-28 4 views
1

Mono 용 .NET Windows 응용 프로그램을 Linux (Ubuntu)에서 실행하도록 변환하고 있습니다. 기능 중 하나는 기본 라이브러리 (user32.dll)에 따라 다릅니다. 응용 프로그램 변환에 대해 이야기하는 Mono 안내서 (Linux Platform Differences)는이 코드를 수정하는 것이 하나의 방법이라고 제안합니다.GDK.Window의 Title 속성을 읽는 방법

Gdk.Global.ActiveWindow 속성을 통해 액세스 할 수있는 Gdk.Window의 제목에 액세스하기 위해 GDK를 사용하려고합니다. 그러나 나는이 오류를 컴파일시에 발견 : 내가 ACTIVEW의 Title 재산 드 읽는 코드를 제거하면

Error CS0154: The property or indexer `Gdk.Window.Title` cannot be used in this context because it lacks the `get` accessor (CS0154) (GetActiveWindow) 

이 모든 것이 잘 작동합니다. 이 속성을 읽는 또 다른 방법이 있습니까? 작품의

다음

내 단위 :

using System; 
using Gtk; 
using Gdk; 
using System.Threading; 

namespace GetActiveWindow 
{ 
    class GdkApp : Gtk.Window 
    { 

     public static void Main() 
     { 
      Application.Init(); 
      new GdkApp(); 
      Application.Run(); 
     } 

     public GdkApp() : base("Simple App") 
     { 
      SetDefaultSize (150, 150); 
      ShowAll(); 
      while (true) { 
       var activeW = Gdk.Global.ActiveWindow; 
       Console.WriteLine("Active Window: {0}",activeW.Title); // Where my compile error happens. 
       Console.WriteLine("Simple App Window: {0}",this.Title); // This code works perfectily. 
       Thread.Sleep(1000); 
      } 
     } 
    } 
} 
+0

그리고 그대가'GDK''에 위치한이 같은 죄송합니다, 내 코드를 첨부하는 것을 잊었다 DJ-크라 @ – MethodMan

+0

을 gtk_window_get_title'처럼 당신이보기를 사용하는 코드를 무엇. –

+0

'class' 클래스는'Title' 속성을가집니다.? 나는 당신이 디스플레이하고 싶거나'Simple App' 콘솔에 나타나길 원한다고 가정합니다. – MethodMan

답변

0

나는 GDK와 함께이 불가능 해라고 생각합니다. Wnck 라이브러리는 C 컴파일러에주는 그것을 시도이 '-DWNCK_I_KNOW_THIS_IS_UNSTABLE'와 작동하지만 경고가 : 내가 대신 발라 요정을

죄송 사용한 _OB_WM_ACTION_UNDECORATE 처리되지 않은 조치 유형.

//valac *.gs --pkg gtk+-3.0 --pkg libwnck-3.0 -X '-DWNCK_I_KNOW_THIS_IS_UNSTABLE' 

init 
    Gtk.init(ref args) 
    var ventana= new win() 
    ventana.inicio() 
    ventana.printinfo() 
    Gtk.main() 


class win:Gtk.Window 

    won:weak GLib.List of Wnck.Window 

    def inicio() 

     var button= new Gtk.Button() 
     button.clicked.connect(printinfo) 
     this.add(button) 
     this.show_all() 

    def printinfo() 
     won= Wnck.Screen.get_default().get_windows() 
     won.foreach(allwin) 

    def allwin(w:Wnck.Window) 
     if w.is_skip_tasklist() or w.is_skip_pager() 
      pass 
     else 
      print w.get_name() 
+0

참고 : 단추를 클릭하면 프로그램에서 모든 창의 이름을 가져옵니다. – txasatonga

관련 문제