inspiriert durch BoBoBo Beitrag in diesem Thread
http://forums.purebasic.com/german/viewtopic.php?t=4141
hab ich mich dran versucht in Gadgets zumalen ohne diese Userlib E2D.
Anhand des Quellcodes kriege ich das auch ganz gut hin - nur! beim freigeben des DC also mit StopDrawing kommt es zum Absturz. Kann aber nicht rausfinden wie das korrekt gemacht werden muß. Die Userlib Pushed dazu das DC und den Whnd auf den Stack. Klappt bei mir leider nicht so doll. Vielleicht hat jemand ne Lösung dazu?
Hier der Versuchs-Code
Code: Alles auswählen
Structure GDrawingInfoStruct
GType.l ; DD 2
GWindow.l
GDC.l
EndStructure
If OpenWindow(0, 100, 200, 640,480,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_WindowCentered , "PureBasic Window")
If CreateGadgetList(WindowID(0))
ContainerGadget(97,0,0,640,480,#PB_Container_Raised)
ButtonGadget(1,10,10,50,25,"Bereich 3")
CloseGadgetList()
Repeat
EventID.l = WaitWindowEvent()
Output.GDrawingInfoStruct\GType=2
Output.GDrawingInfoStruct\GWindow=GadgetID(97)
Output.GDrawingInfoStruct\GDC = GetWindowDC_(GadgetID(97))
StartDrawing(@Output)
Box(0,0,100,100,RGB(0,0,255))
; ;a=Output\GDC
; ;b=Output\GWindow
; ;!PUSH [v_a]
; ;!PUSH [v_b]
;ReleaseDC_(Output\GWindow,Output\GDC)
StopDrawing()
If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
Until Quit = 1
EndIf
EndIf
End
Gruß
FGK