I worked on the lib and added some new "features".
; - added: Combobox-Gadgets
; - added: support for #PB_Any
; - added: #PB_Button_Toggle support for ButtonImageGadgets
; - added: two functions to work with toggled ButtonImageGadgets: SG_SetToggleState() and SG_GetToggleState()
; - changed: improved the performance of most of the commands a bit
; - changed: the name of the command SG_DrawAllGadgets() to SG_DrawGadgets(), because the functionality changed, too
; - changed: the SG_DrawGadgets() can now optionally draw only some of the gadgets
and before I release the new version, I hope s.o. will have a look at it and maxbe play a bit around with it.
I hope there are no more bugs (but surely there are...)

My next interest is:
Does somebody use the lib?
Suggestions for next version?
Thx
Here is a screenshot
and here is the source for that Screenshot
Code: Select all
; Test mit PB_Any
;{ Example
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse()= 0
MessageRequester("Error", "init")
End
EndIf
If OpenWindow(1, 0, 0, 1024, 768, "", #PB_Window_BorderLess)
If OpenWindowedScreen(WindowID(1), 0,0, 1024, 768, 0, 0, 0)
; create a mouse
If CreateSprite(0, 8, 8)
If StartDrawing(SpriteOutput(0))
Circle(4, 4, 4, RGB(255, 255, 255))
StopDrawing()
EndIf
EndIf
Dim GadgNr.l(4)
;{ build Screengadgets
;{ set the appearance for the Imagebutton-gadget
CreateImage(11, 100, 60)
StartDrawing(ImageOutput(11))
Box(0, 0, 100, 60, $00FFFF)
DrawingMode(4)
For x = 0 To 200
Circle(Random(90) + 5, Random(50) + 5, Random(4) + 1, RGB(Random(255), Random(255), Random(255)))
Next
StopDrawing()
SG_SetBackground(0)
SG_SetColor($00FFFF)
;}
GadgNr(0) = SG_ListIconGadget(#PB_Any, 430, 80, 250, 315, "Column0", 100, #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_GridLines) ;
SG_AddGadgetColumn(GadgNr(0), 1, "Column1", 100)
For x = 1 To 8
SG_AddGadgetItem(GadgNr(0), -1, "test " + Str(x) + Chr(10) + "Part 2 / " + Str(x))
Next
SG_SetGadgetItemColor(GadgNr(0), 0, $FF0000, -1)
SG_SetGadgetItemColor(GadgNr(0), 1, $00FF00, -1)
CreateImage(201, 16, 16)
StartDrawing(ImageOutput(201))
Box(0, 0, 16, 16, $FF00FF)
StopDrawing()
SG_AddGadgetItem(GadgNr(0), 5, "test 5 new", ImageID(201))
CreateImage(200, 16, 16)
StartDrawing(ImageOutput(200))
Box(0, 0, 16, 16, $0000FF)
StopDrawing()
SG_AddGadgetItem(GadgNr(0), 8, "test 8 new", ImageID(200))
SG_SetGadgetBackground(GadgNr(0), 0)
SG_SetGadgetColor(GadgNr(0), $00FFFF)
GadgNr(1) = SG_ListIconGadget(#PB_Any, 900, 80, 100, 100, "Column0", 100, #PB_ListIcon_GridLines)
GadgNr(2) = SG_ButtonGadget(#PB_Any, 650, 660, 120, 40, "OK")
SG_SetGadgetColor(GadgNr(2), $FFFFFF)
SG_SetGadgetBackground(GadgNr(2), 0)
GadgNr(3) = SG_ButtonGadget(#PB_Any, 790, 660, 120, 40, "Toggle", #PB_Button_Toggle)
GadgNr(4) = SG_ButtonImageGadget(#PB_Any, 450, 550, 100, 60, ImageID(11), 0)
;}
;{ Eventloop
Repeat ; Start of the event loop
ClearScreen(0)
; DisplaySprite(2, 0, 0) ; play with this to see a background
StartDrawing(ScreenOutput())
StopDrawing()
SG_DrawGadgets(-1, 0)
ExamineMouse ()
DisplayTransparentSprite(0, MouseX(), MouseY())
FlipBuffers(0)
;{ standard loop
Event = SG_ScreenGadgetEvent() ; This line checks if an event happened
GadgetID = SG_EventScreenGadgetID() ; Is it a gadget event?
EventType = SG_EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = GadgNr(2)
If EventType = #SG_EventType_LeftRelease
SG_FreeAllGadgets()
Event = #PB_Event_CloseWindow
EndIf
ElseIf GadgetID = GadgNr(4)
If EventType = #SG_EventType_LeftRelease
SG_FreeGadget(GadgNr(3))
EndIf
EndIf
EndIf
;}
Delay(30)
ExamineMouse()
Until Event = #PB_Event_CloseWindow Or MouseButton(2) ; End of the event loop
;}
EndIf
EndIf
;}
End
http://purebasic.stdojedmahr.de/projekte/Example.zip
and the screenshot
and (at last) the beta of the lib
http://purebasic.stdojedmahr.de/projekte/SGbeta.ZIP