GUI feild select problems 
	 
	
		| Author | 
		Message | 
	 
		 
		Ambiguities
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 4:50 pm    Post subject: GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I'm trying to have fields added into a GUI box with recursion from a tree but it only enters the first variable. can you see what i did wrong?
 
 
i think it might be the way i'm trying to read it
 
 
 
	  | code: | 	 		  procedure showtreefull (crp : ^student)
 
 
    var x : int := GUI.CreateTextBoxChoice (20, 20, 200, 100, 0, 0, ChoseLine)
 
 
    if crp -> ltp not= nil then
 
        showtreefull (crp -> ltp)
 
    end if
 
 
    GUI.AddLine (x, (crp -> lname + ", " + crp -> fname))
 
 
    if crp -> gtp not= nil then
 
        showtreefull (crp -> gtp)
 
    end if
 
end showtreefull  | 	  [/code] | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		corriep
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 5:06 pm    Post subject: RE:GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| You have to create to text box before you call the recursive procedure. Right now you are creating a new text box on every recurse. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Ambiguities
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 5:12 pm    Post subject: Re: GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i reviewed the code removed the creation of the gui box and it wont display any other tree segments... my brain is so tired lol
 
 
	  | code: | 	 		  procedure addtotree (var locptr, crp : ^student)
 
 
    if root = nil then
 
        root := crp
 
    end if
 
    if crp -> lname > locptr -> lname then
 
        if locptr -> gtp not= nil then
 
            addtotree (locptr -> gtp, crp)
 
        else
 
            locptr -> gtp := crp
 
        end if
 
    elsif crp -> lname < locptr -> lname then
 
        if locptr -> ltp not= nil then
 
            addtotree (locptr -> ltp, crp)
 
        else
 
            locptr -> ltp := crp
 
        end if
 
    end if
 
end addtotree  | 	  
 
 
it doesn't error but yet again it doesn't seem to properly work any ideas? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		corriep
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 5:25 pm    Post subject: Re: GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
					  | Turing: | 	 		  procedure showtreefull  (crp  : ^student ) 
    % This line is being called on every recurse, creating many boxes all in the same spot
    % var x : int := GUI.CreateTextBoxChoice (20, 20, 200, 100, 0, 0, ChoseLine) 
    if crp -> ltp  not=  nil then 
        showtreefull  (crp -> ltp ) 
    end if 
    GUI.AddLine (x,  (crp -> lname +  ", " + crp -> fname )) 
    if crp -> gtp  not=  nil then 
        showtreefull  (crp -> gtp ) 
    end if 
end showtreefull
 % If we move it here, the textbox is created once and the lines added
% in the showtreefull procedure will be added to it
var x  : int := GUI.CreateTextBoxChoice (20,  20,  200,  100,  0,  0, ChoseLine ) 
showtreefull  (foo )
  | 	  
 
 
Btw, remember syntax tags   
 
Quote: [syntax="Turing]
 
code here
 
[/syntax]
 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 5:27 pm    Post subject: RE:GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| The reference to textbox should probably be passed to the function, instead of being decleared globally; though either way the point is to have exactly 1 instance of the GUI element. | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Ambiguities
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Mar 11, 2009 8:24 pm    Post subject: Re: GUI feild select problems  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Thanks   | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |