Re: EuGTK - change column label?

new topic     » goto parent     » topic index » view thread      » older message » newer message
Jerry_Story said...
irv said...
atom column = get(tv,"column",1) -- column 1 is actually the second column, thanks to C! 
set(column,"title","Foo!") 
global object 
 lvFoods = CreateLV(8000) <== 1 
 
global constant 
  lstFoods = List:View(lvFoods,{"food","N/100g","N/req cal"}) 
 
atom col 
 
  col = get(lstFoods,"column",0) -- starts with 0 <== 2 
  set(col,"title",sprintf("%d  foods",{length(dl_Foods)}))  

./eugtk_stuff/GtkEngine.e:466 in procedure set()
type_check failure, classname is 0

... called from ./dmak_actions.e:494 in procedure Load_dlFoods()


Line 494 is:

set(col,"title",sprintf("%d  foods",{length(dl_Foods)}))

What did I do wrong?

1 - that creates separate text renderers, one for each column in your view. Probably want 3 or 4 there, not 8000!

2 - The "classname is 0" generally (always?) means that the control in question hasn't been registered with Eugtk. To make sure these columns get registered, add the marked lines to ListView.e:

Note: a call to setRow or setCol will also register the column - that's why my demo worked without the added lines.

export function View(sequence lv, object cols) 
atom tv = create(GtkTreeView) 
atom col -- add 
for i = 1 to length(cols) do  
	addColumn(tv,lv[RENDERERS][i],cols[i],i-1) 
	col = get(tv,"column",i-1) -- add 
	register_object(col,GtkTreeViewColumn) -- add 
end for  
return tv 
end function 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu