//EDIT: Hm es passiert meistens wenn man das window auf die Rechte Bildschirmseite verschiebt... Ich finde irgendwie keinen Grund dafür

//EDIT2: Er zickt irgendwie bei der If Abrage sobald das Window auf der rechten Bildschirmseite ist kommt er nicht mehr durchs if...
//Edit3: Hab gerade mal versucht die Window x y immer nach 4 Secs zu resseten und sobald das window wieder auf der linken seite war wars wieder Moveable... ich versteh das nicht...
hmm Problem Nr.2 das irgendwie keinen Definierbaren Grund hat...
Wenn man die Windows so nen paar mal hin und her geschoben hat (zwischen 1und20 mal) Funtioniert der Mauszeiger zwar noch aber irgendwie reagiert er nicht mehr auf die Window verschiebungen hab schon alles Mögliche debuggen lassen aber entdecke nichts...
Seht ihr nen Fehler?
Code: Alles auswählen
Declare InitWindows()
Declare WindowMGR()
Declare PaintWindows()
#ScreenWidth = 1024
#ScreenHeight = 768
#ScreenName = "PB Windows in Screen"
InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(#ScreenWidth,#ScreenHeight,32,#ScreenName)
Delay(700)
InitWindows()
Structure Window
x.l
y.l
Width.l
Height.l
Schatten.l
Title$
InWindowColor.l
WindowTitleColor.l
ShadowColor.l
TitleTextColorR.l
TitleTextColorG.l
TitleTextColorB.l
Hidden.l
WindowExists.l
EndStructure
Dim Windows.Window(100)
Global ForeGroundWindowID
Global *Thread
Global MouseX
Global MouseY
Procedure WindowMGR()
Protected WindowID
Protected x
Protected y
Protected Width
Protected Height
Repeat
x+1
ExamineMouse()
;Check Mouse in Screen
MouseX=MouseX()
MouseY=MouseY()
If MouseX>#ScreenWidth
MouseX-1
EndIf
If MouseY>#ScreenHeight
MouseY-1
EndIf
If MouseX<1
MouseX+1
EndIf
If MouseY<1
MouseY+1
EndIf
;::::::::Start WindowEventTask::::::::
;::::::::Check WindowMove
If MouseButton(1)>0
For WindowID=0 To 100
x=Windows(WindowID)\x
y=Windows(WindowID)\y
Width=Windows(WindowID)\Width
Height=Windows(WindowID)\Height
;If WindowID=0 Or WindowID=1
;Debug x: Debug y: Debug Width: Debug Height
;EndIf
If MouseX>=x And MouseY>=y And MouseX<=x+Width And MouseX<=y+Height
ForeGroundWindowID=WindowID
Repeat
ExamineMouse()
Windows(WindowID)\x+MouseDeltaX()
Windows(WindowID)\y+MouseDeltaY()
If MouseButton(1)=0
Exit=1
EndIf
If Exit=0
MouseX+MouseDeltaX()
MouseY+MouseDeltaY()
;Check Mouse in Screen
If MouseX>#ScreenWidth
MouseX=#ScreenWidth-1
EndIf
If MouseY>#ScreenHeight
MouseY=#ScreenHeight-1
EndIf
If MouseX<1
MouseX=1
EndIf
If MouseY<1
MouseY=1
EndIf
PaintWindows()
EndIf
Delay(4)
Until Exit =1
EndIf
If Exit=1
Break
EndIf
Next
EndIf
Exit=0
;::::::::End WindowEventTask::::::::
PaintWindows()
Delay(20)
ForEver
EndProcedure
Procedure InitWindows()
*Thread=CreateThread(@WindowMGR(),0)
EndProcedure
Procedure DeactivateWindows()
KillThread(*Thread)
EndProcedure
Procedure OpenScreenWindow(WindowID,x,y,Width,Height,Schatten,Title$,InWindowColor,WindowTitleColor,ShadowColor,TitleTextColorR,TitleTextColorG,TitleTextColorB,Hidden)
Protected WindowID
Windows(WindowID)\x=x
Windows(WindowID)\y=y
Windows(WindowID)\Width=Width
Windows(WindowID)\Height=Height
Windows(WindowID)\Schatten=Schatten
Windows(WindowID)\Title$=Title$
Windows(WindowID)\InWindowColor=InWindowColor
Windows(WindowID)\WindowTitleColor=WindowTitleColor
Windows(WindowID)\ShadowColor=ShadowColor
Windows(WindowID)\TitleTextColorR=TitleTextColorR
Windows(WindowID)\TitleTextColorG=TitleTextColorG
Windows(WindowID)\TitleTextColorB=TitleTextColorB
Windows(WindowID)\Hidden=Hidden
Windows(WindowID)\WindowExists=1
EndProcedure
Procedure CloseScreenWindow(WindowID)
Protected WindowID
Windows(WindowID)\WindowExists=0
EndProcedure
Procedure HideScreenWindow(WindowID,Hidden)
Protected WindowID
Windows(WindowID)\Hidden=Hidden
EndProcedure
Procedure PaintWindow(WindowID)
Protected WindowID
x=Windows(WindowID)\x
y=Windows(WindowID)\y
Width=Windows(WindowID)\Width
Height=Windows(WindowID)\Height
Schatten=Windows(WindowID)\Schatten
Title$=Windows(WindowID)\Title$
InWindowColor=Windows(WindowID)\InWindowColor
WindowTitleColor=Windows(WindowID)\WindowTitleColor
ShadowColor=Windows(WindowID)\ShadowColor
TitleTextColorR=Windows(WindowID)\TitleTextColorR
TitleTextColorG=Windows(WindowID)\TitleTextColorG
TitleTextColorB=Windows(WindowID)\TitleTextColorB
Hidden=Windows(WindowID)\Hidden
WindowExists=Windows(WindowID)\WindowExists
If WindowExists=1
If Schatten=1
Box(x+5,y+5,Width,Height,ShadowColor);Schatten.
EndIf
Box(x,y,Width,Height,InWindowColor) ;FensterInneres
Box(x,y,Width,22,WindowTitleColor) ;TitelLeiste
Line(x ,y,Width, 0,$FFFFFF):Line(x,y , 0,height,$FFFFFF)
Line(x+Width,y, 0,Height,$000000):Line(x,y+height,Width, 0,$000000)
Locate(x+2,y+2) ;Springe zu FensterTitel
DrawingMode(1)
FrontColor(TitleTextColorR, TitleTextColorG, TitleTextColorB)
DrawText(Title$)
EndIf
EndProcedure
Procedure PaintWindows()
Protected WindowID
StartDrawing(ScreenOutput())
Box(0,0,#ScreenWidth,#ScreenHeight)
For WindowID=0 To 100
If WindowID<>ForeGroundWindowID
PaintWindow(WindowID)
EndIf
Next
If ForeGroundWindowID <> -1
WindowID=ForeGroundWindowID
PaintWindow(WindowID)
EndIf
Plot(MouseX,MouseY)
FlipBuffers()
StopDrawing()
EndProcedure
Procedure ActivateScreenWindow(WindowID)
Protected WindowID
ForeGroundWindowID=WindowID
EndProcedure
Procedure MoveScreenWindow(WindowID,x,y)
Protected WindowID
Windows(WindowID)\x=x
Windows(WindowID)\y=y
EndProcedure
OpenScreenWindow(0,200,455,300,200,0,"Window1",$c0c0c0,$ff0000,$404040,255,255,255,0)
OpenScreenWindow(1,100,100,300,500,0,"Window2",$c0c0c0,$ff0000,$404040,255,255,255,0)
Repeat
ExamineKeyboard()
Delay(4)
Until KeyboardPushed(#PB_Key_Escape)
DeactivateWindows()
End
ich weiß meine Art Code zu formatieren ist schrecklich

... bitte bitte bitte helft mir trotzdem