Page 1 of 1

MenuColorPicker class

Posted: Tue Feb 24, 2009 8:54 pm
by srod
Hi,

a while ago I released a little utility for creating a popup menu color selector. Well, I have been in need of a much more flexible version... and here it is! :)


Image


This one allows you to embed the color selector within any popup menu. The only restriction is that the color items must NOT reside within a submenu.

The class only has 4 methods and the the demo program shows all of them in action! :)

Download

Posted: Tue Feb 24, 2009 10:50 pm
by Kwai chang caine
Perfect like always :D

Thanks for sharing 8)

Posted: Tue Feb 24, 2009 11:01 pm
by srod
Thanks, but there's a couple of major bugs in there! :)

Fixing...

Posted: Tue Feb 24, 2009 11:10 pm
by srod
Fixed! :)

If problems persist then I'll have to switch the mouse-hook for a timer or thread.

Posted: Wed Feb 25, 2009 1:23 am
by Mistrel
Fancy. :)

Posted: Wed Feb 25, 2009 12:45 pm
by Kiffi
Mistrel wrote:Fancy. :)
+1

very nice! Thank you :D

Greetings ... Kiffi

Posted: Wed Feb 25, 2009 12:53 pm
by srod
Update - 25th Feb 2009.

The DisplayColorPicker() method now returns a quad value.

In the case that the operation was cancelled without anything being selected then -1 is returned.

In the case that a color value was selected, this value is returned 'as is'.

Otherwise, if one of the other menu items was selected, then the appropriate menuitemID is placed in the upper 32-bits of the return value. The lower 32-bits are set to zero.

This means that you can differentiate between all the various options and you can avoid having to use a callback etc. to obtain the selected menuitemID.

Posted: Wed Feb 25, 2009 1:30 pm
by ts-soft
Image

If you change the two SetWindowLong_() to SetWindowLongPtr_() it works
on 64-Bit.

greetings
Thomas

Posted: Wed Feb 25, 2009 1:47 pm
by srod
ts-soft wrote:Image

If you change the two SetWindowLong_() to SetWindowLongPtr_() it works
on 64-Bit.

greetings
Thomas
Done; thanks! Without access to a 64-bit OS I often forget those things!

Have added a new method for setting the default color as well.