MenuColorPicker class

Share your advanced PureBasic knowledge/code with the community.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

MenuColorPicker class

Post 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
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Perfect like always :D

Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Thanks, but there's a couple of major bugs in there! :)

Fixing...
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Fixed! :)

If problems persist then I'll have to switch the mouse-hook for a timer or thread.
I may look like a mule, but I'm not a complete ass.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Fancy. :)
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post by Kiffi »

Mistrel wrote:Fancy. :)
+1

very nice! Thank you :D

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Image

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

greetings
Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Post Reply