Du kannst PrintN() nicht mit einem Bildschirm geöffnet mit OpenWindowedScreen nutzen. PrintN() funktioniert nur mit einer Konsole. In der Hilfe findest du mehr dazu. Oder hier ist auch gleich ein Beispiel von PureBasic:
;
; ------------------------------------------------------------
;
; PureBasic - Console example file
;
; (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;
text$ = "Feel the Power of PureBasic!" ; just a small text$ string
dlay = 4000 ; delay will set to 4000
;
;-------- Open our Console --------
;
OpenConsole() ; First we must open a console
ConsoleTitle ("PureBasic - Console Example:") ; Now we can give the opened console a Titlename ;)
;
;-------- Ask and display the UserName --------
;
ConsoleLocate (18,12) ; x y position
Print ("Please enter your name: ") ; Ask for name
name$=Input() ; Wait for user input
ClearConsole() ; This will clean the ConsoleScreen
ConsoleLocate (24,10) ; x y position
PrintN ("Welcome "+name$) ; Print our text and the UserName
ConsoleLocate (24,12) ; x y position
PrintN (text$) ; Print our text
Delay (dlay) ; Waits for moment
;
;-------- Cls and Cycle the Text-BG-Color 0 to 15 --------
;
ClearConsole() ; This will clean the ConsoleScreen
; Info: Standard colors are (8 for text, 0 for backround)
For i = 0 To 15
ConsoleColor (0,i) ; Change BackGround text color (max 15) in every loop
ConsoleLocate (24,4+i) ; x y position
Print (text$) ; Print our text
Next i
Delay (dlay) ; Waits for moment
;
;-------- Cls and Cycle the Text-FG-Color 0 to 15 --------
;
ConsoleColor(0,0) ; Set back to black (0,0) for complete background...
ClearConsole() ; This will clean the ConsoleScreen
; Info: Standard colors are (8 for text, 0 for backround)
For i = 0 To 15
ConsoleColor (i,0) ; Change ForGround text color (max 15) in every loop
ConsoleLocate (24,4+i) ; x y position
Print (text$) ; Print our text
Next i
Delay (dlay) ; Waits for moment
;
;-------- Cls and Cycle the Background-Color 0 to 15 --------
;
For a = 1 To 15
ConsoleColor(a,a) ; Cycle background color...
ClearConsole() ; This will clean the ConsoleScreen
; ; Info: Standard colors are (8 for text, 0 for backround)
For i = 0 To 15
ConsoleColor (i,a) ; Change ForGround text color (max 15) in every loop
ConsoleLocate (24,4+i) ; x y position
Print (text$) ; Print our text
Next i
;
Delay(dlay/10) ; Waits for moment
Next a
;-------- Exit --------
CloseConsole()
End
Also daran lags leider doch nicht
Ich benutze ja den DrawText Befehl. Der PrintN steht da nur noch so da, aber wird ja eh nicht angesprochen beim Auführen vom Programm. Rauslöschen bringt auch nix. Das Programm läßt sich ja komplett compilieren und ausführen nur steht dann da bei Windows "Reagiert nicht".
Das ist mein Problem. Irgendeine Speichersache vielleicht???
WindowID = OpenWindow(0,200,200,300,300,#PB_Window_SystemMenu,"Testserver")
CreateGadgetList(WindowID())
TextGadget(1,0,0,300,300,"Server 1.0")
If InitNetwork() = 0
Text$+"Konnte Netzwerk nicht finden !"+Chr(10)+Chr(13)
SetGadgetText(1,Text$)
End
EndIf
Port = 6832
Buffer = AllocateMemory(1000)
If CreateNetworkServer(Port)
Text$+"Server wurde erstellt!"+Chr(10)+Chr(13)
SetGadgetText(1,Text$)
Repeat
Netzwerk = NetworkServerEvent()
If Netzwerk = 1
ClientID = NetworkClientID()
Text$+"Ein neuer Client hat sich angemeldet!"+Chr(10)+Chr(13)
SetGadgetText(1,Text$)
EndIf
If Netzwerk = 4
ClientID = NetworkClientID()
Text$+"Ein Client hat die Verbindung beendet!"+Chr(10)+Chr(13)
SetGadgetText(1,Text$)
EndIf
Event=WaitWindowEvent()
If event=#PB_event_Closewindow
End
EndIf
ForEver
Else
Text$+"Konnte Server nicht erstellen (Wird der Port bereits benutzt ?)"+Chr(10)+Chr(13)
SetGadgetText(1,Text$)
Repeat
Event=WaitWindowEvent()
If event=#PB_event_Closewindow
End
EndIf
ForEver
EndIf