Relearning Blitzplus... a little help please! :)
BlitzPlus Forums/BlitzPlus Beginners Area/Relearning Blitzplus... a little help please! :)| 
 | ||
| I'm trying to have my display work with my Global SCREEN, that when I change SCREEN's value it changes what is displayed but it won't work, I'm sure its something stupid... please help. 
; -----------------------------------------------------------------------------
; Event Constants
; -----------------------------------------------------------------------------
Const EVENT_None		= $0		; No event (eg. a WaitEvent timeout)
Const EVENT_KeyDown		= $101		; Key pressed
Const EVENT_KeyUp		= $102		; Key released
Const EVENT_ASCII		= $103		; ASCII key pressed
Const EVENT_MouseDown	= $201		; Mouse button pressed
Const EVENT_MouseUp		= $202		; Mouse button released
Const EVENT_MouseMove	= $203		; Mouse moved
Const EVENT_Gadget		= $401		; Gadget clicked
Const EVENT_Move		= $801		; Window moved
Const EVENT_Size		= $802		; Window resized
Const EVENT_Close		= $803		; Window closed
Const EVENT_Front		= $804		; Window brought to front
Const EVENT_Menu		= $1001		; Menu item selected
Const EVENT_LostFocus	= $2001		; App lost focus
Const EVENT_GotFocus	= $2002		; App got focus
Const EVENT_Timer		= $4001		; Timer event occurred
; -----------------------------------------------------------------------------
; Globals
; -----------------------------------------------------------------------------
Global SCREEN = 1	;( 0 Nothing, 1 First Screen...)
; -----------------------------------------------------------------------------
; Create Window
; -----------------------------------------------------------------------------
WIN 	= CreateWindow("Game - Patcher", 100, 100, 400, 465, window, 1)
; -----------------------------------------------------------------------------
; Create Window & Layout
; -----------------------------------------------------------------------------
Repeat
	;--------------------------------------------------------------------------
	; Wait for an event from the user.
	;--------------------------------------------------------------------------
	Select WaitEvent()
		Case EVENT_Close
			End
	End Select
	
	;--------------------------------------------------------------------------
	; Keeps track of what your viewing depending on your actions
	;--------------------------------------------------------------------------
	Select SCREEN
		Case 1
			TAB	= CreateTabber(5,5,380,350,WIN)
			
			InsertGadgetItem(TAB,0,"Game News",0)
			InsertGadgetItem(TAB,1,"  List  ",1)
			
			SCREEN = 0
		Case 2
		
	End Select
	
Until (KeyHit(1))
End | 
| 
 | ||
| Why are you creating gadgets in your mainloop anyway? If you want to hide a gadget depending on a variable, then use HideGadget gadget and ShowGadget gadget. The correct order is: 1: initialisation & create 2: mainloop 3: cleanup & exit | 
| 
 | ||
| I dunno I thought like Case 1 ; Show this here Case 2 ; if it case 2 it shows whats here and case 1 doesnt show else with hide, doesn't it just stays in the memory till you show it again? | 
| 
 | ||
| Don't worry about the memory.. we aren't talking megabytes here.. Anyway, I checked that source, the tab shows up when you drag the window around. The tab works when you move the creating process above the loop. There must surely be a reason why things don't work. I don't think I would ever find out, and I don't need to. This is simply not the way it should be done.. :) Just stick to this: 1: initialisation & create 2: mainloop 3: cleanup & exit ..and everyone's happy.. | 
| 
 | ||
| put in a timer *before* ya main loop createtimer(5) repeat ...stuff until keyydown(1) else nothing gets updated until an event is caused, such as dragging the window. |