dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Jul 20, 1998

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Color Dialog (Common Dialog)

Question:
How can I use the CHOOSECOLOR WIN32 API with Powerbuilder?

Answer:
Create a custom user object and declare the following local structure:

long		lstructsize
ulong		hwndowner
ulong		hinstance
long		rgbresult
blob		lpcustcolors
long		flags
long		lcustdata
long		lpfnhook
long		lptemplatename
then declare the following instance variables:
Private:
os_ChooseColor istr_ChooseColor
long il_CustomInitColors[16]
blob{64} ibl_CustomColors
Declare the following local external function:
function boolean ChooseColorA( REF os_ChooseColor  lpcc ) library "comdlg32.dll"
In the constructor event of your object add the following code:
// initialize choosecolor information

// convert the default custom color array to a blob variable
blobedit(ibl_customcolors,1,il_custominitcolors)

// let the structure element point to the blob array
istr_choosecolor.lpcustcolors = ibl_customcolors 

// set the size
istr_choosecolor.lStructSize = 36

// no owner 
SetNull(istr_choosecolor.hwndOwner)

// set flag
istr_choosecolor.flags = 1
Then finally add a function boolean of_choosecolor(ref long al_rgbresult) with the following code:
boolean lb_ok

istr_ChooseColor.rgbresult = al_rgbresult

lb_ok = ChooseColorA ( istr_choosecolor )

al_rgbresult = istr_ChooseColor.rgbresult 

return lb_ok
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date