問題

我正在使用Glade將列表框新增到視窗,然後使用Gtk.jl的GtkBuilder將GUI載入到Julia中.載入列表框Julia認為它是GtkContainer小部件而不是列表框(列表框似乎不存在於Julia包的原始碼中,除了一個或兩個註釋).我已經搜尋了Gtk.jl原始碼,只是找不到任何東西(或者理解我正在看的東西).

一些Listbox訊號有效,但最重要的訊號(“row-entive”)沒有.我真的需要這個訊號發出....這是否沒有實現?有錯誤嗎?我做錯了什麼嗎?我只需要使用更復雜的GTKTreeView嗎?

julia程式碼的註釋行是沒有觸發的訊號(我也不真正關心).根據Gtk文件,“啟用”訊號是GtkListboxRow的,它是使用者需要使用的“row-entive”訊號,但我無法讓它發出...

“listbox Example.glade”:

 <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkWindow" id="win">
    <property name="can_focus">False</property>
    <child>
      <placeholder/>
    </child>
    <child>
      <object class="GtkListBox" id="lb">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <child>
          <object class="GtkListBoxRow">
            <property name="width_request">100</property>
            <property name="height_request">80</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">label1</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkListBoxRow">
            <property name="width_request">100</property>
            <property name="height_request">80</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">label2</property>
              </object>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkListBoxRow">
            <property name="width_request">100</property>
            <property name="height_request">80</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">label3</property>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>
 
 using Gtk

app = GtkBuilder(filename = "listbox Example.glade")

win = app["win"]

lb = app["lb"]

showall(win)

# id1 = signal_connect(lb, "activate-cursor-row") do widget
#     println("activate-cursor-row")
# end

# id2 = signal_connect(lb, "move-cursor") do widget
#     println("move-cursor")
# end

id3 = signal_connect(lb, "row-activated") do widget
    println("row-activated")
end

id4 = signal_connect(lb, "row-selected") do widget
    println("row-selected")
end

id5 = signal_connect(lb, "select-all") do widget
    println("select-all")
end

id6 = signal_connect(lb, "selected-rows-changed") do widget
    println("selected-rows-change")
end

# id7 = signal_connect(lb, "toggle-cursor-row") do widget
#     println("toggle-cursor-row")
# end

id8 = signal_connect(lb, "unselect-all") do widget
    println("unselect-all")
end

# id9 = signal_connect(lb, "activate") do widget
#     println("activate")
# end
 
 julia> typeof(lb)
Gtk.GtkContainerLeaf
 

  最佳答案

  相同標籤的其他問題

listboxgtkjuliasignalsglade