View Full Version : setting position of color picker
shannen
July 25th, 2003, 10:23 AM
Hi all,
Does anybody know how I can get the PickColor control to start-up at a specified position? I tried setting the value in the following ways (psuedo code):
ColorPickerInfo.placeWhere=kAtSpecifiedOrigin;
ColorPickerInfo.dialogOrigin.v = 10;
ColorPickerInfo.dialogOrigin.h = 10;
Also, from the documentation, it mentioned that the dialogOrigin structure is suppose to contain the position of the dialog when it returns. Apparently, the debugging information that I got did not contain this. Appreciate for all help rendered and thank you very much once again
shannen
July 29th, 2003, 10:48 AM
Hi all,
Is everybody clueless to my problem? I really appreciate if anyone could help me with any types of possible solution. Thank you very much once again
Arden
July 29th, 2003, 10:04 PM
Does it work? If not, it might be saying that it starts at that distance from the default, which I believe is right next to the window you're selecting from. I'm not sure how to get it to behave correctly.
shannen
July 30th, 2003, 10:28 AM
ai....sad to say, it does not work and tt't y i badly needed help on this. in fact, it does not even come out on the side of the window. it appears in the center of the screen, just like setting the placeWhere flag to the center. HELPPPPPP
tjw
July 31st, 2003, 10:45 AM
I'm not familiar with Carbon, but I did find this: http://developer.apple.com/documentation/Carbon/Reference/Color_Picker_Manager/index.html
shannen
July 31st, 2003, 11:55 AM
Thanks for the link provided. that was the exact one that i used to reference and came up with the stated code but it failed to work....oh my god!!!! i am so helpless........:(
tjw
July 31st, 2003, 12:14 PM
Can you attach the code in question so i/we could play with it?
shannen
July 31st, 2003, 12:30 PM
Hi,
The following is the function that I wrote to prompt the ColorPicker dialog. The input parameter is the color that I wanted the dialog to pick. Everything works except for the position setting. Thank you all so much.
>>>>>>>>>>>>>>>>>>>>
*/
bool CDialogs::PromptObjectTimebarColor( ::CColor& ioColor )
{
bool theUserSelected = false;
::CColor theStateColor = ioColor;
CMRGBColor theColor = { theStateColor.GetRed( ) * 256, theStateColor.GetGreen( ) * 256, theStateColor.GetBlue( ) * 256 };
NPMColor thePMColor = { NULL, theColor };
long theVal;
::Gestalt(gestaltColorPickerVersion, &theVal );
// Initialize the color picker
NColorPickerInfo theInfo;
theInfo.theColor = thePMColor;
theInfo.dstProfile = NULL;
//theInfo.placeWhere = kCenterOnMainScreen;
theInfo.placeWhere = kAtSpecifiedOrigin;
theInfo.dialogOrigin.v = 0;
theInfo.dialogOrigin.h = 0;
theInfo.pickerType = 0;
theInfo.eventProc = NULL;
theInfo.colorProc = NULL;
theInfo.colorProcData = 0;
short theR;
short theG;
short theB;
// Run the color picker and if there wansn't an err, then set the color
if ( ( NPickColor( &theInfo ) == noErr ) && ( theInfo.newColorChosen ) )
{
theR = theInfo.theColor.color.rgb.red / 256;
theG = theInfo.theColor.color.rgb.green / 256;
theB = theInfo.theColor.color.rgb.blue / 256;
ioColor = ::CColor( theR, theG, theB );
theUserSelected = true;
}
return theUserSelected;
}
wiz
July 31st, 2003, 11:40 PM
do u mind formatting it please enclose it in [ code ]...[/ code ] tags
shannen
August 1st, 2003, 09:56 AM
sure i can but why is there a need? Pardon me for my ignorance. Is it some devt tools specific stuff? I am using code warrior. Let me know how you want me to enclose it? (every line ?) thanks again
wiz
August 1st, 2003, 07:54 PM
the whole block of text but hey np... it's pretty neat
shannen
August 4th, 2003, 04:43 PM
oh gosh...seems like this is not an easy problem....its been a week.... :'(