Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Support for system colours
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Support for system colours

 Post Reply Post Reply
Author
Message
sbclarke View Drop Down
Newbie
Newbie


Joined: 06 April 2010
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote sbclarke Quote  Post ReplyReply Direct Link To This Post Topic: Support for system colours
    Posted: 14 May 2010 at 4:40am
We are migrating our GUI to CodeJock controls to benefit from the modern look and feel and great controls such as the PropertyGrid. However, I cannot find a way to change the functionality of the colour picker to include system colours.

We have a separate colour-picker we could use (although would prefer to use the CodeJock in-built style) by calling from pgMyPropertyGrid_InplaceButtonDown(... and setting Cancel to True, but we then cannot retrieve the colour from Value as it appears to translate system colours to RGB.

Is it possible to add our own small control (ocx) rather than a button into a property grid item? - This would be our preferred solution as we can keep the same look and feel for this control as our previous (but limited) implementation (See below for screen shots).

Alternatively, I could do this with an enumerated list and addiitional in-place button, but cannot find out how to change the background colour of the inplace button (We want the colour preview feature)

Thanks,
Simon

Wish List...

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2010 at 6:33am
Hi,
 
Q:We have a separate colour-picker we could use (although would prefer to use the CodeJock in-built style) by calling from pgMyPropertyGrid_InplaceButtonDown(... and setting Cancel to True, but we then cannot retrieve the colour from Value as it appears to translate system colours to RGB.
 
A: In ValueChanged event value of Item.Value is long (only Item will show RGB)
 
Q: Is it possible to add our own small control (ocx) rather than a button into a property grid item? - This would be our preferred solution as we can keep the same look and feel for this control as our previous (but limited) implementation (See below for screen shots).
A: You could use a dropdown button and calculate Item position / size and show your control (see VB sample Propertygrid where MenuItem is used for showing dropdown menu)
 
 
Q: Alternatively, I could do this with an enumerated list and addiitional in-place button, but cannot find out how to change the background colour of the inplace button (We want the colour preview feature)

A: There's no property to change the backgroundcolor but you could use an enumerated Item (with a list of System colors) and add Icons as colors (like the combobox in VB IDE) see also propertygrid sample where icons are added in combo.
 
 
Good luck
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
sbclarke View Drop Down
Newbie
Newbie


Joined: 06 April 2010
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote sbclarke Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2010 at 10:20am
Thanks for your reply Aaron,

"In ValueChanged event value of Item.Value is long (only Item will show RGB)"
We are using VB6 where all colours including system colours are represented by a value of type Long. System colours are enumerated as negative numbers eg:&H8000000F& and API calls are available to convert to RGB and back so the property grid could manage this if it didn't ignore system colours.

"You could use a dropdown button and calculate Item position / size and show your control (see VB sample Propertygrid where MenuItem is used for showing dropdown menu)"
I have tried this and with some success - the problem is we use the scroll bars and I have not found an event that traps the scrolling, so it looks very strange when you scroll, I haven't given up with this yet though although I want avoid using a timer! Other complications are that categories being collapsed will need the control hiding as we want to leave the control visible for the preview colour.

"There's no property to change the backgroundcolor but you could use an enumerated Item (with a list of System colors) and add Icons as colors (like the combobox in VB IDE) see also propertygrid sample where icons are added in combo."
This is a great suggestion - I will look into this as I was not aware I could add icons to the enumerated property lists - I might need to render the icons with the colours selected on the host machine though.

Its a shame CodeJock have chosen not to support system colours with their colour picker

Thanks again,
Simon





Back to Top
sbclarke View Drop Down
Newbie
Newbie


Joined: 06 April 2010
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote sbclarke Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2010 at 3:08am
Solved

I have managed this reasonably cleanly by writing a helper class for the PropertyGrid control. This allows you to create a new colour picker made up of an enumerated list with icons rendered with the system colours (as suggested by Aaron) and an additional in-place button to choose colours using the XtremeSuiteControls CommonDialogue control. It took some effort to work out what all the flags do as I could not find this in the help. The keyboard can be used to type the colour too.  In addition it offers three child sliders to allow you to change the RGB values without the CommonDialogue being open.

I have use very little API code and have rendered the icons using dynamically loaded PictureBoxes and saving the image to the Windows TEMP folder.

I have uploaded the code and documentation if anyone finds it helpful or interesting. This was built and tested for CodeJock 13.3.1 - See uploads/20100528_030528_ColourPropsHelp.zip

I may post an update supporting web safe colours and their names if anyone is interested.

Simon

Screen Shots:

 
Product: Xtreme SuitePro (ActiveX) version 13.3.1
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0 (mostly)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2010 at 2:40pm
Very nice! Thanks for this Simon.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 04 June 2010 at 11:52am
Hi Simon,
 
So you solved the issue yourself !?!? 
If you want system colors in your application it's a nice option to have. Thanks for sharing this
 
And keep up the good work !
 
  
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.