'############################################################################################################## Dim Shared G_Screen_ReDraw as UByte '-------------------------------------------------------------------------------------------------------------- Type Vektor_2D_Type X as Integer Y as Integer End Type '-------------------------------------------------------------------------------------------------------------- Type Debug_Type V_FPS_Calc as Integer V_FPS_Draw as Integer End Type '-------------------------------------------------------------------------------------------------------------- Type Form_Mouse_Type V_BV as Integer V_X as Integer V_Y as Integer V_Z as Integer V_Button as Integer End Type '-------------------------------------------------------------------------------------------------------------- Type Form_Control_Type V_InUse as UByte V_Type as UInteger V_Pos as Vektor_2D_Type V_Dimension as Vektor_2D_Type V_Visible as UByte V_Enable as UByte T_DrawMem as Any Ptr T_Redraw as UByte End Type '-------------------------------------------------------------------------------------------------------------- Type Form_Color_Type V_Back as UInteger V_Border as UInteger V_BorderFill as UInteger V_Text as UInteger V_BarBack as UInteger V_BarText as UInteger End Type Type Form_Style_Type V_Bar as UByte V_Border as UByte V_ButtonMax as UByte V_ButtonMin as UByte V_ButtonExit as UByte End Type Type Form_Type V_InUse as UByte V_FID as UInteger V_Pos as Vektor_2D_Type V_Dimension as Vektor_2D_Type V_Visible as UByte V_Enable as UByte V_Color as Form_Color_Type V_Style as Form_Style_Type V_Caption as String V_Sizeable as UByte T_DrawMem as Any Ptr T_Redraw as UByte V_ControlD as Form_Control_Type Ptr V_ControlC as UInteger End Type '-------------------------------------------------------------------------------------------------------------- Dim Shared G_FormD() as Form_Type Dim Shared G_FormZ() as UInteger Dim Shared G_FormC as UInteger Dim Shared G_FormIDC as UInteger '-------------------------------------------------------------------------------------------------------------- Dim Shared G_FormMutex as Any Ptr '-------------------------------------------------------------------------------------------------------------- Dim Shared G_FormDefauld_Color as Form_Color_Type Dim Shared G_Form_Bar_Size as UInteger: G_Form_Bar_Size = 14 Dim Shared G_Form_Border_Size as UInteger: G_Form_Border_Size = 1 '-------------------------------------------------------------------------------------------------------------- Dim Shared G_Form_DebugSystem as UByte: G_Form_DebugSystem = 1 Dim Shared G_Form_Debug_Time as Double Dim Shared G_Form_Debug_Data as Debug_Type Dim Shared G_Form_Debug_Last as Debug_Type Dim Shared G_Form_Debug_Clear as Debug_Type '-------------------------------------------------------------------------------------------------------------- Dim Shared G_Form_Mouse_AK as Form_Mouse_Type Dim Shared G_Form_Mouse_Last as Form_Mouse_Type Dim Shared G_Form_Mouse_Drag as Vektor_2D_Type Dim Shared G_Form_Mouse_Size as Vektor_2D_Type Dim Shared G_Form_Mouse_Pos as Vektor_2D_Type Dim Shared G_Form_MoveID as UInteger Dim Shared G_Form_DragID as UInteger '############################################################################################################## Declare Function MKVektor2D (V_X as Integer, V_Y as Integer) as Vektor_2D_Type '-------------------------------------------------------------------------------------------------------------- Declare Function F_Form_Add (V_Position as Vektor_2D_Type, V_Dimension as Vektor_2D_Type, V_Caption as String, V_Visible as UByte = 1, V_Enable as UByte = 1, V_ShowBar as UByte = 1, V_Sizeable as UByte = 1, V_Border as UByte = 1, V_ButtonExit as UByte = 1, V_ButtonMax as UByte = 1, V_ButtonMin as UByte = 1) as Integer '-------------------------------------------------------------------------------------------------------------- Declare Function F_Form_SetFocus (V_FID as UInteger) as Integer Declare Function F_Form_Move (V_FID as UInteger, V_X as Integer, V_Y as Integer, V_MoveLock as UByte = 0) as Integer Declare Function F_Form_Resize (V_FID as UInteger, V_Width as Integer, V_Height as Integer) as Integer '-------------------------------------------------------------------------------------------------------------- Declare Function F_Form_Redraw (V_FID as UInteger) as Integer Declare Function F_Form_Refresh () as UInteger '-------------------------------------------------------------------------------------------------------------- Declare Function F_Form_CheckInput () as Integer Declare Function F_Form_GetFID_OnMouse (V_X as Integer, V_Y as Integer) as UInteger Declare Function F_Form_CheckBorderDrag (V_FID as UInteger, V_X as Integer, V_Y as Integer) as UInteger '############################################################################################################## Function MKVektor2D(V_X as Integer, V_Y as Integer) as Vektor_2D_Type Dim T as Vektor_2D_Type T.X = V_X T.Y = V_Y Return T End Function '############################################################################################################## Function F_Form_Add(V_Position as Vektor_2D_Type, V_Dimension as Vektor_2D_Type, V_Caption as String, V_Visible as UByte = 1, V_Enable as UByte = 1, V_ShowBar as UByte = 1, V_Sizeable as UByte = 1, V_Border as UByte = 1, V_ButtonExit as UByte = 1, V_ButtonMax as UByte = 1, V_ButtonMin as UByte = 1) as Integer If V_Dimension.X < G_Form_Bar_Size Or V_Dimension.Y < G_Form_Bar_Size Then Return 0 Dim FID as UInteger MutexLock(G_FormMutex) For X as UInteger = 1 to G_FormC If G_FormD(X).V_InUse = 0 Then FID = X: Exit For Next If FID = 0 Then G_FormC += 1 FID = G_FormC Redim Preserve G_FormD(G_FormC) as Form_Type Redim Preserve G_FormZ(G_FormC) as UInteger End If Dim FOK as UByte Do FOK = 1 G_FormIDC += 1 If G_FormIDC = 0 Then G_FormIDC = 1 For X as UInteger = 1 to G_FormC If G_FormD(X).V_InUse = 1 And G_FormD(X).V_FID = G_FormIDC Then FOK = 0: Exit For Next If FOK = 1 Then Exit Do Loop Dim XFIDC as UInteger = G_FormIDC With G_FormD(FID) .V_InUse = 1 .V_FID = XFIDC .V_Enable = V_Enable .V_Visible = V_Visible .V_Pos = V_Position .V_Dimension = V_Dimension .V_Caption = V_Caption .T_Redraw = 1 .V_Color = G_FormDefauld_Color .V_Sizeable = V_Sizeable With .V_Style .V_Bar = V_ShowBar .V_Border = V_Border .V_ButtonMax = V_ButtonMax .V_ButtonMin = V_ButtonMin .V_ButtonExit = V_ButtonExit End With If .T_DrawMem <> 0 Then ImageDestroy(.T_DrawMem) .T_DrawMem = ImageCreate(.V_Dimension.X, .V_Dimension.Y, 24) End With MutexUnLock(G_FormMutex) F_Form_SetFocus(XFIDC) Return XFIDC End Function '-------------------------------------------------------------------------------------------------------------- Function F_Form_Del(V_FID as UInteger) as Integer MutexLock(G_FormMutex) For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then If G_FormD(X).V_InUse = 1 Then With G_FormD(X) .V_InUse = 0 If .V_ControlC > 0 Then If .V_ControlD <> 0 Then Deallocate(.V_ControlD) .V_ControlD = 0 .V_ControlC = 0 End If If .T_DrawMem <> 0 Then ImageDestroy(.T_DrawMem) End With End If MutexUnLock(G_FormMutex) Return V_FID End If Next MutexUnLock(G_FormMutex) Return 0 End Function '-------------------------------------------------------------------------------------------------------------- Sub F_Form_Clear() MutexLock(G_FormMutex) For X as UInteger = 1 to G_FormC If G_FormD(X).V_InUse = 1 Then With G_FormD(X) .V_InUse = 0 If .V_ControlC > 0 Then If .V_ControlD <> 0 Then Deallocate(.V_ControlD) .V_ControlD = 0 .V_ControlC = 0 End If If .T_DrawMem <> 0 Then ImageDestroy(.T_DrawMem) End With End If Next MutexUnLock(G_FormMutex) End Sub '############################################################################################################## Function F_Form_SetFocus(V_FID as UInteger) as Integer MutexLock(G_FormMutex) Dim XSID as UInteger = 0 Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormZ(X) > 0 Then If G_FormD(G_FormZ(X)).V_FID = V_FID Then XFID = X: Exit For Else: If XSID = 0 Then XSID = X End if Next If XFID = 0 Then XFID = XSID If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 If XFID = 1 And G_FormC > 1 Then MutexUnLock(G_FormMutex): Return V_FID For X as UInteger = XFID - 1 To 1 step -1 G_FormZ(X + 1) = G_FormZ(X) Next G_FormZ(1) = V_FID MutexUnLock(G_FormMutex) F_Form_Redraw(V_FID) Return V_FID End Function '-------------------------------------------------------------------------------------------------------------- Function F_Form_Move(V_FID as UInteger, V_X as Integer, V_Y as Integer, V_MoveLock as UByte = 0) as Integer MutexLock(G_FormMutex) Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then XFID = X: Exit For Next If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 With G_FormD(XFID) If V_MoveLock <> 1 Then .V_Pos.X = V_X If V_MoveLock <> 2 Then .V_Pos.Y = V_Y End With G_Screen_ReDraw = 1 MutexUnLock(G_FormMutex) Return V_FID End Function '-------------------------------------------------------------------------------------------------------------- Function F_Form_Resize(V_FID as UInteger, V_Width as Integer, V_Height as Integer) as Integer MutexLock(G_FormMutex) Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then XFID = X: Exit For Next If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 With G_FormD(XFID) If V_Width > 0 Then .V_Dimension.X = V_Width If V_Height > 0 Then .V_Dimension.Y = V_Height If .T_DrawMem <> 0 Then ImageDestroy(.T_DrawMem) .T_DrawMem = ImageCreate(.V_Dimension.X, .V_Dimension.Y, 24) .T_Redraw = 1 End With G_Screen_ReDraw = 1 MutexUnLock(G_FormMutex) Return V_FID End Function '############################################################################################################## Function F_Form_Control_Add(V_FID as UInteger, V_Type as UInteger, V_Position as Vektor_2D_Type, V_Dimension as Vektor_2D_Type, V_Visible as UByte = 1, V_Enable as UByte = 1) as Integer If V_Dimension.X < 1 Or V_Dimension.Y < 1 Then Return 0 MutexLock(G_FormMutex) Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then XFID = X: Exit For Next If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 Dim XCID as UInteger With G_FormD(XFID) For X as UInteger = 1 to .V_ControlC If .V_ControlD[X].V_InUse = 0 Then XCID = X: Exit For Next Dim XTCD as Form_Control_Type If XCID = 0 Then If .V_ControlC = 0 Then .V_ControlD = Allocate(SizeOf(Form_Control_Type) + 1) .V_ControlC += 1 XCID = .V_ControlC .V_ControlD = ReAllocate(.V_ControlD, SizeOf(Form_Control_Type) + 1) End If Dim FOK as UByte With XTCD .V_InUse = 1 .V_Enable = V_Enable .V_Visible = V_Visible .V_Pos = V_Position .V_Dimension = V_Dimension .T_Redraw = 1 If .T_DrawMem <> 0 Then ImageDestroy(.T_DrawMem) .T_DrawMem = ImageCreate(.V_Dimension.X, .V_Dimension.Y, 24) End With .V_ControlD[XCID] = XTCD .T_Redraw = 1 End With MutexUnLock(G_FormMutex) G_Screen_ReDraw = 1 Return XCID End Function '############################################################################################################## Function F_Form_Redraw(V_FID as UInteger) as Integer MutexLock(G_FormMutex) Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then XFID = X: Exit For Next If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 If G_FormD(XFID).V_InUse = 0 or G_FormD(XFID).T_Redraw = 0 Then MutexUnLock(G_FormMutex): Return 0 With G_FormD(XFID) If .V_InUse = 1 And .T_Redraw = 1 Then For X as UInteger = 1 to .V_ControlC If .V_ControlD[X].V_InUse = 1 and .V_ControlD[X].V_Visible = 1 Then If .V_ControlD[X].T_Redraw = 1 Then End If With .V_ControlD[X] Put G_FormD(XFID).T_DrawMem, (.V_Pos.X, .V_Pos.Y), .T_DrawMem, (0, 0)-(.V_Dimension.X, .V_Dimension.Y), PSet End With End If Next Line .T_DrawMem, (0, 0)-(.V_Dimension.X - 1, .V_Dimension.Y - 1), .V_Color.V_Back, BF If .V_Style.V_Bar = 1 Then Line .T_DrawMem, (0, 0)-(.V_Dimension.X - 1, G_Form_Bar_Size + G_Form_Border_Size * 2), .V_Color.V_BarBack, BF If .V_Style.V_ButtonExit = 1 Then Draw String .T_DrawMem, (G_Form_Bar_Size * 2 + 4 + G_Form_Border_Size + 4, G_Form_Border_Size + 5), .V_Caption, .V_Color.V_BarText Else: Draw String .T_DrawMem, (G_Form_Border_Size + 4, G_Form_Border_Size + 5), .V_Caption, .V_Color.V_BarText End If End If If .V_Style.V_Border = 1 Then Line .T_DrawMem, (0, 0)-(.V_Dimension.X - 1, .V_Dimension.Y - 1), .V_Color.V_Border, B For X as UInteger = 1 to G_Form_Border_Size Line .T_DrawMem, (X, X)-(.V_Dimension.X - X - 1, .V_Dimension.Y - X - 1), .V_Color.V_BorderFill, B Next If .V_Style.V_Bar = 1 Then Line .T_DrawMem, (G_Form_Border_Size + 1, G_Form_Bar_Size + G_Form_Border_Size + 3)-(.V_Dimension.X - G_Form_Border_Size - 2, G_Form_Bar_Size + (G_Form_Border_Size * 2) + 2), .V_Color.V_BorderFill, BF Line .T_DrawMem, (G_Form_Border_Size + 1, G_Form_Border_Size + 1)-(.V_Dimension.X - G_Form_Border_Size - 2, G_Form_Bar_Size + G_Form_Border_Size + 2), .V_Color.V_Border, B Line .T_DrawMem, (G_Form_Border_Size + 1, G_Form_Bar_Size + (G_Form_Border_Size * 2) + 3)-(.V_Dimension.X - G_Form_Border_Size - 2, .V_Dimension.Y - G_Form_Border_Size - 2), .V_Color.V_Border, B If .V_Style.V_ButtonMax = 1 Then Line .T_DrawMem, (.V_Dimension.X - (G_Form_Border_Size + 2), G_Form_Border_Size + 2)-(.V_Dimension.X - (G_Form_Border_Size + G_Form_Bar_Size * 2 + 1), G_Form_Border_Size + G_Form_Bar_Size + 1), .V_Color.V_BorderFill, BF Line .T_DrawMem, (.V_Dimension.X - (G_Form_Border_Size + 2), G_Form_Border_Size + 2)-(.V_Dimension.X - (G_Form_Border_Size + G_Form_Bar_Size * 2 + 1), G_Form_Border_Size + G_Form_Bar_Size + 1), .V_Color.V_Border, B End If If .V_Style.V_ButtonExit = 1 Then Line .T_DrawMem, (G_Form_Border_Size + 2, G_Form_Border_Size + 2)-(G_Form_Border_Size + G_Form_Bar_Size * 2 + 1, G_Form_Border_Size + G_Form_Bar_Size + 1), .V_Color.V_BorderFill, BF Line .T_DrawMem, (G_Form_Border_Size + 2, G_Form_Border_Size + 2)-(G_Form_Border_Size + G_Form_Bar_Size * 2 + 1, G_Form_Border_Size + G_Form_Bar_Size + 1), .V_Color.V_Border, B Draw String .T_DrawMem, (G_Form_Bar_Size - (G_Form_Bar_Size / 2) + 2 + G_Form_Border_Size + 4, G_Form_Border_Size + 5), "X", .V_Color.V_BarText End If Else: Line .T_DrawMem, (G_Form_Border_Size + 1, G_Form_Border_Size + 1)-(.V_Dimension.X - G_Form_Border_Size - 2, .V_Dimension.Y - G_Form_Border_Size - 2), .V_Color.V_Border, B End if End If .T_Redraw = 0 End If End With MutexUnLock(G_FormMutex) G_Screen_ReDraw = 1 Return V_FID End Function '-------------------------------------------------------------------------------------------------------------- Function F_Form_Control_Redraw(V_FID as UInteger) as Integer MutexLock(G_FormMutex) MutexUnLock(G_FormMutex) Return V_FID End Function '############################################################################################################## Function F_Form_Refresh() as UInteger If G_Screen_ReDraw = 0 Then Return 0 Dim FCR as UInteger Dim XFID as UInteger MutexLock(G_FormMutex) For X as UInteger = 1 To G_FormC If G_FormZ(X) > 0 Then With G_FormD(G_FormZ(X)) If .V_InUse = 1 And .T_Redraw = 1 Then XFID = G_FormZ(X) MutexUnLock(G_FormMutex) F_Form_Redraw(XFID) MutexLock(G_FormMutex) FCR += 1 End If End With End If Next ScreenLock Line (0, 0)-(1024, 768), 0, BF For X as UInteger = G_FormC To 1 Step -1 If G_FormZ(X) > 0 Then With G_FormD(G_FormZ(X)) Put (.V_Pos.X, .V_Pos.Y), .T_DrawMem, (0, 0)-(.V_Dimension.X, .V_Dimension.Y), PSet End With End If Next If G_Form_DebugSystem = 1 Then With G_Form_Mouse_AK Locate 1, 1 Print "FPS_Calc: " & G_Form_Debug_Data.V_FPS_Calc Print "FPS_Draw: " & G_Form_Debug_Data.V_FPS_Draw Print "" Print "Maus_X:" & .V_X Print "Maus_Y:" & .V_Y Print "Maus_Z:" & .V_Z Print "Maus_B:" & .V_Button Print "" Print "FormC: " & G_FormC Print "FormZ: "; For X as UInteger = 1 to G_FormC Print G_FormZ(X) & " "; Next Print "" Print "FID_Move: " & G_Form_MoveID Print "FID_Drag: " & G_Form_DragID End With End If ScreenUnLock If G_Form_DebugSystem = 1 Then G_Form_Debug_Last.V_FPS_Draw += 1 MutexUnLock(G_FormMutex) Return FCR End Function '############################################################################################################## Function F_Form_CheckInput() as Integer If G_Form_DebugSystem = 1 Then If G_Form_Debug_Time <= Timer Then G_Form_Debug_Data = G_Form_Debug_Last G_Form_Debug_Last = G_Form_Debug_Clear G_Form_Debug_Time = Timer + 1 End If End if Dim MX as Integer Dim MY as Integer Dim MZ as Integer Dim MB as Integer Dim BV as Integer If G_Form_DebugSystem = 1 Then G_Form_Mouse_Last = G_Form_Mouse_AK With G_Form_Mouse_AK .V_BV = Getmouse(.V_X, .V_Y, .V_Z, .V_Button) If .V_BV <> 0 Then If G_Form_DebugSystem = 1 Then F_Form_Refresh() Return -1 'unbekannter Fehler End If If .V_Button = -1 Then If G_Form_DebugSystem = 1 Then F_Form_Refresh() Return -2 'Keine Maus gefunden End If If .V_X = G_Form_Mouse_Last.V_X and G_Form_Mouse_Last.V_Y = .V_Y and G_Form_Mouse_Last.V_Z = .V_Z and G_Form_Mouse_Last.V_Button = .V_Button Then F_Form_Refresh(): Return 0 G_Form_Debug_Last.V_FPS_Calc += 1 Dim XFID as UInteger If .V_Button = 1 Then If G_Form_MoveID = 0 Then XFID = F_Form_GetFID_OnMouse(.V_X, .V_Y) If XFID > 0 Then G_Form_DragID = F_Form_CheckBorderDrag(XFID, .V_X, .V_Y) If G_Form_Mouse_Last.V_Button = 0 Then G_Form_MoveID = XFID MutexLock(G_FormMutex) If G_Form_DragID > 0 Then G_Form_Mouse_Drag.X = .V_X G_Form_Mouse_Drag.Y = .V_Y G_Form_Mouse_Size = G_FormD(XFID).V_Dimension End If G_Form_Mouse_Pos.X = G_FormD(XFID).V_Pos.X - .V_X G_Form_Mouse_Pos.Y = G_FormD(XFID).V_Pos.Y - .V_Y MutexUnLock(G_FormMutex) F_Form_SetFocus(XFID) End If Else: G_Form_DragID = 0 End If Else If G_Form_MoveID > 0 Then Select Case G_Form_DragID Case 0: If F_Form_Move(G_Form_MoveID, G_Form_Mouse_Pos.X + .V_X, G_Form_Mouse_Pos.Y + .V_Y) = 0 Then G_Form_MoveID = 0 Case 1 If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X - .V_X + G_Form_Mouse_Drag.X, 0) = 0 Then G_Form_MoveID = 0 If F_Form_Move(G_Form_MoveID, G_Form_Mouse_Drag.X + .V_X - G_Form_Mouse_Drag.X + G_Form_Mouse_Pos.X, 0, 2) = 0 Then G_Form_MoveID = 0 Case 2: If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X + .V_X - G_Form_Mouse_Drag.X, 0) = 0 Then G_Form_MoveID = 0 Case 4 If F_Form_Resize(G_Form_MoveID, 0, G_Form_Mouse_Size.Y - .V_Y + G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 If F_Form_Move(G_Form_MoveID, 0, G_Form_Mouse_Drag.Y + .V_Y - G_Form_Mouse_Drag.Y + G_Form_Mouse_Pos.Y, 1) = 0 Then G_Form_MoveID = 0 Case 8: If F_Form_Resize(G_Form_MoveID, 0, G_Form_Mouse_Size.Y + .V_Y - G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 Case 5 If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X - .V_X + G_Form_Mouse_Drag.X, G_Form_Mouse_Size.Y - .V_Y + G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 If F_Form_Move(G_Form_MoveID, G_Form_Mouse_Drag.X + .V_X - G_Form_Mouse_Drag.X + G_Form_Mouse_Pos.X, G_Form_Mouse_Drag.Y + .V_Y - G_Form_Mouse_Drag.Y + G_Form_Mouse_Pos.Y, 0) = 0 Then G_Form_MoveID = 0 Case 6 If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X + .V_X - G_Form_Mouse_Drag.X, G_Form_Mouse_Size.Y - .V_Y + G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 If F_Form_Move(G_Form_MoveID, 0, G_Form_Mouse_Drag.Y + .V_Y - G_Form_Mouse_Drag.Y + G_Form_Mouse_Pos.Y, 1) = 0 Then G_Form_MoveID = 0 Case 9 If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X - .V_X + G_Form_Mouse_Drag.X, G_Form_Mouse_Size.Y + .V_Y - G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 If F_Form_Move(G_Form_MoveID, G_Form_Mouse_Drag.X + .V_X - G_Form_Mouse_Drag.X + G_Form_Mouse_Pos.X, 0, 2) = 0 Then G_Form_MoveID = 0 Case 10: If F_Form_Resize(G_Form_MoveID, G_Form_Mouse_Size.X + .V_X - G_Form_Mouse_Drag.X, G_Form_Mouse_Size.Y + .V_Y - G_Form_Mouse_Drag.Y) = 0 Then G_Form_MoveID = 0 End Select End If End If Else G_Form_MoveID = 0 G_Form_DragID = 0 End If F_Form_Refresh() End With Return XFID End function '-------------------------------------------------------------------------------------------------------------- Function F_Form_GetFID_OnMouse(V_X as Integer, V_Y as Integer) as UInteger MutexLock(G_FormMutex) For X as UInteger = 1 To G_FormC With G_FormD(G_FormZ(X)) If .V_InUse = 1 And .V_Visible = 1 Then If V_X >= .V_Pos.X and V_X <= .V_Pos.X + .V_Dimension.X and V_Y >= .V_Pos.Y and V_Y <= .V_Pos.Y + .V_Dimension.Y Then Dim XFID as UInteger = G_FormD(G_FormZ(X)).V_FID MutexUnLock(G_FormMutex) Return XFID End If End If End With Next MutexUnLock(G_FormMutex) Return 0 End Function '-------------------------------------------------------------------------------------------------------------- Function F_Form_CheckBorderDrag(V_FID as UInteger, V_X as Integer, V_Y as Integer) as UInteger MutexLock(G_FormMutex) Dim XFID as UInteger = 0 For X as UInteger = 1 to G_FormC If G_FormD(X).V_FID = V_FID Then XFID = X: Exit For Next If XFID = 0 Then MutexUnLock(G_FormMutex): Return 0 If G_FormD(XFID).V_InUse = 0 Then MutexUnLock(G_FormMutex): Return 0 Dim XDID as UInteger With G_FormD(XFID) If V_X >= .V_Pos.X and V_X <= .V_Pos.X + G_Form_Border_Size + 2 Then XDID = XDID Or 1 If V_X <= .V_Pos.X + .V_Dimension.X and V_X >= .V_Pos.X + .V_Dimension.X - G_Form_Border_Size - 2 Then XDID = XDID Or 2 If V_Y >= .V_Pos.Y and V_Y <= .V_Pos.Y + G_Form_Border_Size + 2 Then XDID = XDID Or 4 If V_Y <= .V_Pos.Y + .V_Dimension.Y and V_Y >= .V_Pos.Y + .V_Dimension.Y - G_Form_Border_Size - 2 Then XDID = XDID Or 8 End With MutexUnLock(G_FormMutex) Return XDID End Function