
-----------------------------------
jamonathin
Sat Feb 18, 2006 4:53 pm

AssertFailed - GUI.Quit Problem
-----------------------------------
Hey all, im stumped right now.  I'm getting an error message that reads


Dispose: widget id number "18105" not found

and I looked it up in GUI and apparently it's in this:


procedure RemoveWidget (id : int)
	var prevNode : ^WidgetNode := nil
	var widgetNode : ^WidgetNode := firstWidgetNode
	var tempNode : ^WidgetNode := widgetNode
	% Remove the widgetNode from the linked list
	loop
	    exit when widgetNode = nil
	    if widgetNode -> id = id then
		if prevNode = nil then
		    firstWidgetNode := widgetNode -> next
		else
		    prevNode -> next := widgetNode -> next
		end if

		% Dispose of the widget and the widgetNode.
		widgetNode -> widget -> Dispose
		free widgetNode -> widget
		free widgetNode

		return
	    end if
	    prevNode := widgetNode
	    widgetNode := widgetNode -> next
	end loop
	AssertFailed ("Dispose: widget id number \"" +
	    intstr (id) + "\" not found")
    end RemoveWidget


(at the bottom)

My question is, what is causing this?

-----------------------------------
Delos
Sat Feb 18, 2006 10:57 pm


-----------------------------------
What is causing this error.  Where's your code?  Help us out a little! :D

It's likely caused by a show/hide error, or a reference to a widget that hasn't been initialized.

As a side note, stop using Turing's GUI.  Make your own!

-----------------------------------
jamonathin
Sun Feb 19, 2006 2:26 am


-----------------------------------
Well, im not going to post the entire program, but i'll give u a snip of it.
Basically what's going wrong is, whenever i go into this procedure, and fully complete it without cancling it (you'll see in code), GUI.Quit gets an error.  But if I do choose to cancel it, no error will pop up.  

Here's the entire procedure, and the only part different from the finish and cancel.

if forLoopDone then
        GUI.Dispose (newTractorIDb)
        GUI.Dispose (newLicenseNumberb)
        GUI.Dispose (yearb)
        GUI.Dispose (makeb)
        GUI.CloseWindow (tractorWindow)

        errorWindow := Window.Open ("graphics:250;80,nobuttonbar,position:center;center,title:New Truck Added : " + hTractorID + ",offscreenonly")
        colorback (black)
        var colorCount : int := 16
        var diff : int := 1
        error := true

        loop
            colorback (colorCount)
            cls
            Input.KeyDown (key)
            Window.SetActive (errorWindow)
            colorCount += diff
            Font.Draw ("Truck " + hTractorID + " has been added to Fleet " + intstr (fleetNumber) + ".", 20, 60, font, 46 - colorCount)
            Font.Draw ("Press any key to continue", 45, 15, font, 46 - colorCount)
            if colorCount = 28 or colorCount = 16 then
                diff *= -1
            end if
            View.Update
            delay (75)
            exit when hasch
        end loop

        GUI.CloseWindow (errorWindow)
        Window.SetActive (mainWindow)
        tractorWindow := 0
        errorWindow := 0
        cancel := false
    end if
