Question:
How can I call the Windows color dialog box in Powerbuilder 6.0?
Answer:
To use the Windows standard color chooser dialog, you will need to declare and use some API calls. Create a new nonvisual object and define a structure in your object with the following attributes:
long lstructsizeulong hwndownerulong hinstancelong rgbresultblob lpcustcolorslong flagslong lcustdatalong lpfnhooklong lptemplatename
Then define the following instance variables:
YOUR_STRUCTURENAME istr_ChooseColourLong il_CustomCols[16]Blob{64} ibl_CustomColours
In the constructor event add the following code:
BlobEdit( ibl_CustomColours, 1, il_CustomCol )istr_ChooseColour.lpcustcolors = ibl_CustomColours istr_ChooseColour.lStructSize = 36SetNull( istr_ChooseColor.hwndOwner )istr_ChooseColour.flags = 1
Then define the following API call:
function boolean ChooseColorA( REF YOURSTRUCTURE_NAME lpcc ) library "commdlg"
Then define a function and add the following code:
ChooseColorA ( istr_ChooseColour )RETURN istr_ChooseColor.rgbresult