07-12-2016, 12:42 PM
Another, simple Color Dialog routine can be found in :
Simple ColorDialog
I attach, herewith a short routine I have written to simplify the use of this color dialog :
Function My_Color_Dialog
I have found the following version somewhere in the forum, I am afraid I do not remember where :
Function ColorDialog
Simple ColorDialog
I attach, herewith a short routine I have written to simplify the use of this color dialog :
Function My_Color_Dialog
str si.getmacro(getopt(itemid) 1)
if ideb; out "%s : %s" NowT si
int col
str s
;g1
if(ColorDialog(col s))
,;out "0x%06X" col
,;out s
,s.format("0x%06X" col)
,_s="Selected color string in Clipboard - Colors in QM are defined as BGR"
,
,Task_Message _s 0 col 1
,_s.from("Selected BGR-QM color code :[][]" s "[][]Continue ?")
,int i=mes(_s si "YN")
,s.setclip
,beeS 300 300
else
,ret
if i=89; goto g1I have found the following version somewhere in the forum, I am afraid I do not remember where :
Function ColorDialog
;/
function# int&colorInt [str&colorStr] [hwndOwner]
;Shows Color dialog.
;Returns 1 on OK, 0 on Cancel.
;colorInt - receives color value in format 0xBBGGRR.
;colorStr - receives color formatted as string.
;hwndOwner (QM 2.3.4) - handle of owner window or 0.
;EXAMPLE
;int col
;if(ColorDialog(col))
,;out "0x%X" col
type ___MYCOLORS ft c[16]
___MYCOLORS+ ___mycolors
if(___mycolors.ft=0) ___mycolors.ft=1; for(_i 0 16) ___mycolors.c[_i]=0xa0a0a0
CHOOSECOLOR cc.lStructSize=sizeof(CHOOSECOLOR)
cc.hWndOwner=hwndOwner
cc.flags=CC_FULLOPEN | CC_RGBINIT
cc.lpCustColors=&___mycolors.c
cc.rgbResult=0xa0a0a0
if(!ChooseColor(&cc)) 0; ret
if(&colorInt) colorInt=cc.rgbResult
if(&colorStr) colorStr.format("0x%X" cc.rgbResult)
0
ret 1