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


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

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