Verfasst: 11.05.2009 18:32
Bis jetzt habe ich immer nur auf SizeWindow reagiert und hat immer funktiert. Warum sollte ich auf MoveWindow reagieren?
Standard Baustein für Testprogramme.
Standard Baustein für Testprogramme.
Code: Alles auswählen
;-TOP
EnableExplicit
;- Konstanten
Enumeration ; Window ID
#Window
EndEnumeration
Enumeration ; Menu ID
#Menu
EndEnumeration
Enumeration ; MenuItem ID
#Menu_Exit
EndEnumeration
Enumeration ; Statusbar ID
#Statusbar
EndEnumeration
Enumeration ; Gadget ID
#List_Log
EndEnumeration
; ***************************************************************************************
;- Declare Functions
Declare UpdateWindow()
Declare WriteLog(text.s)
;- Globale Variablen
Global exit = 0
Procedure main()
Protected event, winstyle
;- Fenster
winstyle = #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 300, "Fenster", winstyle)
; Menu
If CreateMenu(#Menu, WindowID(#Window))
MenuTitle("&Datei")
MenuItem(#Menu_Exit, "Be&enden")
EndIf
; Statusbar
CreateStatusBar(#Statusbar, WindowID(#Window))
; Gadgets
If #True ; CreateGadgetList(WindowID(#Window))
ListViewGadget(#List_Log, 0,0,0,0)
EndIf
;-- Hauptschleife
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Menu
Select EventMenu()
Case #Menu_Exit
exit = 1
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Window : exit = 1
EndSelect
Case #PB_Event_SizeWindow
Select EventWindow()
Case #Window : UpdateWindow()
EndSelect
EndSelect
Until Exit
EndIf
EndProcedure:main()
; ***************************************************************************************
Procedure UpdateWindow()
Protected x,y,dx,dy
Protected mn,st,tb
x = 0
y = 0
mn = MenuHeight()
st = StatusBarHeight(#StatusBar)
;tb = ToolBarHeight(#ToolBar)
dx = WindowWidth(#Window)
dy = WindowHeight(#Window) - mn - st - tb
ResizeGadget(#List_Log, x, y, dx, dy)
EndProcedure
; ***************************************************************************************
Procedure WriteLog(text.s)
Protected temp.s
temp = FormatDate("%YYYY.%MM.%DD %HH:%II:%SS - ", Date()) + text
AddGadgetItem(#List_Log, -1, temp)
If CountGadgetItems(#List_Log) > 500
RemoveGadgetItem(#List_Log, 0)
EndIf
EndProcedure
; ***************************************************************************************