ColorSelector - Gadget : for Linux and Windows (PB 4.x)
Posted: Thu Apr 19, 2007 8:22 pm
Here's a little Gadget I'd needed for my app... I decided to release it so maybe someone can improve it if desired... (for me this version works well)
Should compile on Windows and Linux without change....
here's a screenshot:

a small demo-App (compiled on Linux) where you simply can change the Background color (maybe not visible on all machines due to the different theming-engines):
http://home.arcor.de/x-linux/pure/col_picker
and the source:
http://home.arcor.de/x-linux/pure/col_picker.pb
the demo-app (source):
I guess, it's self-explanatory.... but if you have questions, feel free to ask
As always, comments, suggestions etc. are welcome
It's planned, to release a similar gadget as a toolbarbutton (like the colorselector in the toolbars of gnumeric, office-calc, excel etc.) but this will take a while...
Should compile on Windows and Linux without change....
here's a screenshot:

a small demo-App (compiled on Linux) where you simply can change the Background color (maybe not visible on all machines due to the different theming-engines):
http://home.arcor.de/x-linux/pure/col_picker
and the source:
http://home.arcor.de/x-linux/pure/col_picker.pb
the demo-app (source):
Code: Select all
;- demo
XIncludeFile "col_picker.pb"
Procedure select_color()
back_color=$80667F
a=col_picker(20,back_color)
If a >-2
SetWindowColor(0,a)
EndIf
EndProcedure
OpenWindow(0,0,0,200,200,"Color-Select",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
If CreateGadgetList(WindowID(0))
*button1=ButtonGadget(#PB_Any,50,50,100,25,"click me")
registerGadgetEvent(*button1,@select_color())
EndIf
Repeat
Event = WaitWindowEvent()
Gadget = EventGadget()
Type = EventType()
Window = EventWindow()
Select Event
Case #PB_Event_Gadget
CallEventFunction(Window, Event, Gadget, Type)
Case #PB_Event_CloseWindow
quit=1
EndSelect
Until quit=1
End
As always, comments, suggestions etc. are welcome
It's planned, to release a similar gadget as a toolbarbutton (like the colorselector in the toolbars of gnumeric, office-calc, excel etc.) but this will take a while...