1. EuGTK:TreeViiew Parents & Children

Forked from Re: EuGTK:How to Build a TreeView

irv said...

See the updated function ShowSelection() in the new pasty to see how it works - it obtains the clicked (selected) item, for example, Grumpy Cat, and then obtains the item's parent, adds it to the head of our result, and recurses until there is no parent left. Results:

Mac -> The Woz -> Susan (the other kid) -> Grumpy Cat

Of course, you can format the result however you wish.

https://openeuphoria.org/pastey/312.wc

Irv, I'm getting a value of -1 for each of these atom vars:

atom fn1 = define_c_func(LIBS[1],"gtk_tree_selection_get_selected",{P,P,P},P)  
atom fn2 = define_c_func(LIBS[1],"gtk_tree_model_iter_parent",{P,P,P},B)  
atom fn3 = define_c_func(LIBS[1],"gtk_tree_iter_copy",{P},P)  

Can you confirm these should work on Windows?

new topic     » topic index » view message » categorize

2. Re: EuGTK:TreeViiew Parents & Children

I can confirm that it won't. Windows isn't smart enough to find the functions when they're located in various dll's.

There is a solution for this windows problem built into EuGTK. Give me an hour or two to get to a windows computer and I'll post it here.

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuGTK:TreeViiew Parents & Children

irv said...

I can confirm that it won't. Windows isn't smart enough to find the functions when they're located in various dll's.

There is a solution for this windows problem built into EuGTK. Give me an hour or two to get to a windows computer and I'll post it here.

Drat! OK.

I guess I could always install a virtual Linux box to this Windows PC... smile

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuGTK:TreeViiew Parents & Children

EuGTK has a way to work around that: tested on Windows10

----------------------------------  
global function ShowSelection() --  
----------------------------------  
atom iter = allocate(32), model = allocate(32), parent = allocate(32)  
 
object result   
if gtk_func("gtk_tree_selection_get_selected",{P,P,P},{selection,model,iter}) then  
	 
        result = get(store,"value",iter,1)  
	display(result) -- just shows clicked item;  
  
	while gtk_func("gtk_tree_model_iter_parent",{P,P,P},{store,parent,iter}) do  
		result = get(store,"value",parent,1)  & " -> " & result  
		iter = gtk_func("gtk_tree_iter_copy",{P},{parent})  
	end while -- look up parents; 
 
	display(result) -- or, Info(,,result) if you prefer; 
        -- show full path to clicked item;  
	-- e.g: Mac -> The Woz -> Billy (the kid) -> Fido  
  
end if  
return 1  
end function  

I suppose it would be 'nice' to have this as a function call in EuGTK, but so seldom used, it's probably not a big deal.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu