function returns 0 and no int ¿

Blitz3D Forums/Blitz3D Programming/function returns 0 and no int ¿

GC-Martijn(Posted 2005) [#1]
The id must be the lastid+1 so I made this below.
But the function window_newId%() returning 0.

Type Window
	Field id%
End Type

Function window_newId%()
	wnd.window = Last Window
	DebugLog wnd\id% ;returns everytime 0
		
Return 3;(wnd\id%+1)
End Function

Function window()
	wnd.window 	= New Window
	wnd\id%		= window_newId%()
End Function

While Not KeyHit(1)
	window()
	Delay 2000
Wend
End


Thanks =)


Floyd(Posted 2005) [#2]
You are doing this:

1. Create a new window.
2. Display the window id.
3. Set the id = 3.


big10p(Posted 2005) [#3]
Type window
	Field id%
End Type

Function window_newId%()
	wnd.window = Before Last Window
	If wnd=Null Then Return 0 Else Return wnd\id%+1
End Function

Function window()
	wnd.window = New Window
	wnd\id% = window_newId%()
End Function

While Not KeyHit(1)
	window()
	Delay 2000
Wend
End



GC-Martijn(Posted 2005) [#4]
Oyea, Thanx