adding color picker to old program

BlitzMax Forums/BlitzMax Beginners Area/adding color picker to old program

LeeFbx(Posted 2008) [#1]
I'm trying to put the MaxGUI Color Picker into an old program that uses the usual " While not escape key " main loop. This almost works, but I can't get back to the main loop after calling the color picker.


Global R% = 0, G% = 0, B% = 255

Graphics 800,600,0
SetClsColor(R,G,B)
Cls ; Flip

While Not KeyHit(KEY_ESCAPE)
If KeyDown(Key_E) End
If KeyDown(KEY_C) Then Pick_Color
Wend

Function Pick_Color()

If RequestColor(R,G,B)
R=RequestedRed()
G=RequestedGreen()
B=RequestedBlue()
SetClsColor(R,G,B)
Cls ; Flip
EndIf

End Function

Do I have to call some gadget first? And if so, do I need to free resources when I'm done with the color picker? What is the minimum I need to get the above to work?

Thanks,
-Lee


grable(Posted 2008) [#2]
Add a FlushKeys after (or before, doesnt matter) calling your Pick_Color function.