Computer Science Canada

Gui Select Field problem, please help or tell me it won't work

Author:  Ambiguities [ Thu Mar 12, 2009 11:19 pm ]
Post subject:  Gui Select Field problem, please help or tell me it won't work

unfortunately i ran into another snag.... with the recursive gui select box it displays all the students who were entered but im having issues with ChoseLine

i'm trying to work with just one variable from chose line which is the line number but i'm trying to access the pointer. my search function works to find the student but when i try and do it with the int it fails for all but the first and last cause it doesn't meet the requirements for the if statement

code:
procedure selectivedisplay (crp : ^student, count : int, var numcheck : int)

        if count not= -1 then
            numcheck += 1
        end if

        if root not= nil then

            if crp -> ltp not= nil then
                selectivedisplay (crp -> ltp, count, numcheck)
            elsif crp -> gtp not= nil then
                selectivedisplay (crp -> gtp, count, numcheck)

            %i understand that the below code wont work but i'm unsure how to send a varaible through ChoseLine as GUI doesn't have much support documents for it.

            elsif numcheck = count then
                put crp -> lname, ", ", crp -> fname
            end if
        end if

end selectivedisplay

% GUI

procedure ChoseLine (line : int)
    var x : int := 0
    winID2 := Window.Open ("graphics:300;20,nobuttonbar,position:center+100;center")
    selectivedisplay (root, line, x)
end ChoseLine



i know global variables seem like a good idea but i want to avoid it at all costs

all of this is being entered from the previous thread

code:

var x : int := GUI.CreateTextBoxChoice (20, 20, 200, 100, 0, 0, ChoseLine)
        showtreefull (root, x)

Author:  Ambiguities [ Fri Mar 13, 2009 10:14 am ]
Post subject:  Re: Gui Select Field problem, please help or tell me it won't work

I got tired of waiting and watching no one reply so I looked into this further and realized that no one can help me but me so I modified the way turing works and reads procedures and made it work the way i want it to.


: