2016-07-14 50 views
3

有了這個代碼:爲什麼gtkmm行get_value不起作用?

size = 100; 
uint64_t work; 
row.get_value(3, work); 
cout << "value was " << work << endl; 
work += size; 
cout << "value set to " << work << endl; 
row.set_value(3, work); 
row.get_value(3, work); 
cout << "value now " << work << endl; 

我希望這樣的輸出:

value was 0 
value set to 100 
value now 100 

,但我得到:

value was 0 
value set to 100 
value now 0 

更新值,100,正確不顯示在樹視圖控件,我無法用get_value讀取它。我究竟做錯了什麼?

+0

查看'set_value()'的文檔;你確定'row'仍然指向同一行嗎? – andlabs

回答

1

原來的問題是uint64_t; row [3]被定義爲(在Glade中)作爲guint,工作變量必須完全匹配該類型,否則get_value將不起作用。