Page 1 of 2

Better ColorRequester()

Posted: Mon May 08, 2017 8:58 pm
by blueb
The PB ColorRequester() only opens the basic color screen, and does not remember the users choices.

Hopefully this will be a bit better...

Once compiled, use it in your programs with RunProgram() :)

Code: Select all

;==================================================================
;
; Author:     blueb    
; Date:       May 8, 2017
; Explain:    Create a new ColorRequester that saves User Colors (between calls)
;          
; Saved as:  FullColorRequester.pb 
;=========================================================

EnableExplicit
; --------------------------------------------------------------------------
; Goal - write a 'Unique' preference file in the temporary directory that 
; stays in the temporary directory even when user switches to other programs.
; It will keep the special colors the user last adjusted.
; --------------------------------------------------------------------------
Declare InitPrefs()
Declare ExitPrefs()

Structure COLORREF
  RGB.l[16]
EndStructure 

; Structure CHOOSECOLOR ; see PB toolbox
;      lStructSize.l
;      hwndOwner.i
;      hInstance.i
;      rgbResult.l
;      *lpCustColors
;      Flags.l
;      lCustData.i
;      *lpfnHook
;      *lpTemplateName
; EndStructure

Define CHOOSECOLOR.CHOOSECOLOR

Define COLORREF.COLORREF
Global prefOpen.i, SelectedClipResult.s

; needed for preferences file.
Global.i  COLORREF1, COLORREF2, COLORREF3, COLORREF4, COLORREF5, COLORREF6, COLORREF7, COLORREF8, COLORREF9 
Global.i  COLORREF10, COLORREF11, COLORREF12, COLORREF13, COLORREF14, COLORREF15, COLORREF16

InitPrefs()

; place saved colors inside requester()
COLORREF\RGB[0] = COLORREF1
COLORREF\RGB[1] = COLORREF2
COLORREF\RGB[2] = COLORREF3
COLORREF\RGB[3] = COLORREF4
COLORREF\RGB[4] = COLORREF5
COLORREF\RGB[5] = COLORREF6
COLORREF\RGB[6] = COLORREF7
COLORREF\RGB[7] = COLORREF8
COLORREF\RGB[8] = COLORREF9
COLORREF\RGB[9] = COLORREF10
COLORREF\RGB[10] = COLORREF11
COLORREF\RGB[11] = COLORREF12
COLORREF\RGB[12] = COLORREF13
COLORREF\RGB[13] = COLORREF14
COLORREF\RGB[14] = COLORREF15
COLORREF\RGB[15] = COLORREF16

CHOOSECOLOR\LStructSize = SizeOf(CHOOSECOLOR)
CHOOSECOLOR\hwndOwner = 0;WindowID(#Window)
CHOOSECOLOR\rgbResult = 0 ; nothing selected
CHOOSECOLOR\lpCustColors = COLORREF
CHOOSECOLOR\flags = #CC_ANYCOLOR | #CC_FULLOPEN | #CC_RGBINIT

Procedure InitPrefs()
; ===================================
; Color Preference file - Storage information
;

prefOpen = OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs") ; test and create if necessary

If prefOpen = 0 ; Does not exist... so create it.
     
   ; Default values - if "GetUserColors.prefs" is erased
 
          prefOpen = CreatePreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
          
          WritePreferenceInteger("COLORREF1",  COLORREF1)  ; the first color
          WritePreferenceInteger("COLORREF2",  COLORREF2)  
          WritePreferenceInteger("COLORREF3",  COLORREF3)  
          WritePreferenceInteger("COLORREF4",  COLORREF4)  
          WritePreferenceInteger("COLORREF5",  COLORREF5)  
          WritePreferenceInteger("COLORREF6",  COLORREF6)  
          WritePreferenceInteger("COLORREF7",  COLORREF7)  
          WritePreferenceInteger("COLORREF8",  COLORREF8)  
          WritePreferenceInteger("COLORREF9",  COLORREF9)  
          WritePreferenceInteger("COLORREF10",  COLORREF10)  
          WritePreferenceInteger("COLORREF11",  COLORREF11)  
          WritePreferenceInteger("COLORREF12",  COLORREF12)  
          WritePreferenceInteger("COLORREF13",  COLORREF13)  
          WritePreferenceInteger("COLORREF14",  COLORREF14)  
          WritePreferenceInteger("COLORREF15",  COLORREF15)  
          WritePreferenceInteger("COLORREF16",  COLORREF16)  
    ClosePreferences()
   
Else ; it exists
          ; Retrieve the GetUserColors.prefs information
          COLORREF1 = ReadPreferenceInteger("COLORREF1", COLORREF1) 
          COLORREF2 = ReadPreferenceInteger("COLORREF2", COLORREF2) 
          COLORREF3 = ReadPreferenceInteger("COLORREF3", COLORREF3) 
          COLORREF4 = ReadPreferenceInteger("COLORREF4", COLORREF4) 
          COLORREF5 = ReadPreferenceInteger("COLORREF5", COLORREF5) 
          COLORREF6 = ReadPreferenceInteger("COLORREF6", COLORREF6) 
          COLORREF7 = ReadPreferenceInteger("COLORREF7", COLORREF7) 
          COLORREF8 = ReadPreferenceInteger("COLORREF8", COLORREF8) 
          COLORREF9 = ReadPreferenceInteger("COLORREF9", COLORREF9)     
          COLORREF10 = ReadPreferenceInteger("COLORREF10", COLORREF10)
          COLORREF11 = ReadPreferenceInteger("COLORREF11", COLORREF11)
          COLORREF12 = ReadPreferenceInteger("COLORREF12", COLORREF12)
          COLORREF13 = ReadPreferenceInteger("COLORREF13", COLORREF13)
          COLORREF14 = ReadPreferenceInteger("COLORREF14", COLORREF14)
          COLORREF15 = ReadPreferenceInteger("COLORREF15", COLORREF15)
          COLORREF16 = ReadPreferenceInteger("COLORREF16", COLORREF16)
  ClosePreferences()
   Debug COLORREF1 
EndIf
 EndProcedure
 
Procedure ExitPrefs()
       
     PrefOpen = OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
    
  If prefOpen
          WritePreferenceInteger("COLORREF1",  COLORREF1)  ; the first color
          WritePreferenceInteger("COLORREF2",  COLORREF2)  
          WritePreferenceInteger("COLORREF3",  COLORREF3)  
          WritePreferenceInteger("COLORREF4",  COLORREF4)  
          WritePreferenceInteger("COLORREF5",  COLORREF5)  
          WritePreferenceInteger("COLORREF6",  COLORREF6)  
          WritePreferenceInteger("COLORREF7",  COLORREF7)  
          WritePreferenceInteger("COLORREF8",  COLORREF8)  
          WritePreferenceInteger("COLORREF9",  COLORREF9)  
          WritePreferenceInteger("COLORREF10",  COLORREF10)  
          WritePreferenceInteger("COLORREF11",  COLORREF11)  
          WritePreferenceInteger("COLORREF12",  COLORREF12)  
          WritePreferenceInteger("COLORREF13",  COLORREF13)  
          WritePreferenceInteger("COLORREF14",  COLORREF14)  
          WritePreferenceInteger("COLORREF15",  COLORREF15)  
          WritePreferenceInteger("COLORREF16",  COLORREF16)  
       
   EndIf
   If prefOpen
          ClosePreferences()
   EndIf     
EndProcedure

;==================================================================
;------- Place CHOOSECOLOR Info into requester()
;==================================================================

If ChooseColor_(@CHOOSECOLOR)
     COLORREF1 =COLORREF\RGB[0]
     COLORREF2 =COLORREF\RGB[1]
     COLORREF3 =COLORREF\RGB[2]
     COLORREF4 =COLORREF\RGB[3]
     COLORREF5 =COLORREF\RGB[4]
     COLORREF6 =COLORREF\RGB[5]
     COLORREF7 =COLORREF\RGB[6]
     COLORREF8 =COLORREF\RGB[7]
     COLORREF9 =COLORREF\RGB[8]
     COLORREF10 =COLORREF\RGB[9]
     COLORREF11 =COLORREF\RGB[10]
     COLORREF12 =COLORREF\RGB[11]
     COLORREF13 =COLORREF\RGB[12]
     COLORREF14 =COLORREF\RGB[13]
     COLORREF15 =COLORREF\RGB[14]
     COLORREF16 =COLORREF\RGB[15]
     
  SelectedClipResult.s = Str(CHOOSECOLOR\rgbResult)
  SetClipboardText(SelectedClipResult.s)
  
  Debug "Color Selected: " + CHOOSECOLOR\rgbResult
  
Else
  Debug "No color was selected."
EndIf

ExitPrefs() ; save info

End


Re: Better ColorRequester()

Posted: Tue May 09, 2017 12:57 am
by IdeasVacuum
That is a thing of beauty! Thanks for sharing blueb.

Re: Better ColorRequester()

Posted: Tue May 09, 2017 2:25 am
by blueb
IdeasVacuum wrote:That is a thing of beauty! Thanks for sharing blueb.
Glad it can be of use. :D

I got onto the idea when I was playing with SweetyVD and couldn't save colors.

I took a look to see what others had done and simply incorporated some of their ideas.

I think PureBasic should make something like this, instead of the regular requester.

Re: Better ColorRequester()

Posted: Tue May 09, 2017 8:02 am
by RSBasic
Thanks for sharing. Image

Re: Better ColorRequester()

Posted: Tue May 09, 2017 8:18 am
by walbus
Nice

Re: Better ColorRequester()

Posted: Tue May 09, 2017 2:43 pm
by ChrisR
Very good and Useful, thanks for sharing :)

Without changing anything and to fully integrate it into SweetyVD, I changed the RunProgram() for a procedure

Code: Select all

;==================================================================
;
; Author:     blueb
; Date:       May 8, 2017
; Explain:    Create a new ColorRequester that saves User Colors (between calls)
; Forum:      http://www.purebasic.fr/english/viewtopic.php?f=12&t=68450
; Saved as:   FullColorRequester.pb
;=========================================================

EnableExplicit
; --------------------------------------------------------------------------
; Goal - write a 'Unique' preference file in the temporary directory that 
; stays in the temporary directory even when user switches to other programs.
; It will keep the special colors the user last adjusted.
; --------------------------------------------------------------------------
Declare InitColorPrefs()
Declare ExitColorPrefs()
Declare FullColorRequester()

Structure COLORREF
  RGB.l[16]
EndStructure 

; Structure CHOOSECOLOR ; see PB toolbox
;      lStructSize.l
;      hwndOwner.i
;      hInstance.i
;      rgbResult.l
;      *lpCustColors
;      Flags.l
;      lCustData.i
;      *lpfnHook
;      *lpTemplateName
; EndStructure

; Needed for preferences file.
Global.i  COLORREF1, COLORREF2, COLORREF3, COLORREF4, COLORREF5, COLORREF6, COLORREF7, COLORREF8, COLORREF9 
Global.i  COLORREF10, COLORREF11, COLORREF12, COLORREF13, COLORREF14, COLORREF15, COLORREF16

Procedure InitColorPrefs()   ;Color Preference file - Storage information
  If OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs") = 0 ; Does not exist, "GetUserColors.prefs" is erased. So create it with Default values
    CreatePreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
    WritePreferenceInteger("COLORREF1", COLORREF1)   ;The first color
    WritePreferenceInteger("COLORREF2", COLORREF2)
    WritePreferenceInteger("COLORREF3", COLORREF3)
    WritePreferenceInteger("COLORREF4", COLORREF4)
    WritePreferenceInteger("COLORREF5", COLORREF5)
    WritePreferenceInteger("COLORREF6", COLORREF6)
    WritePreferenceInteger("COLORREF7", COLORREF7)
    WritePreferenceInteger("COLORREF8", COLORREF8)
    WritePreferenceInteger("COLORREF9", COLORREF9)
    WritePreferenceInteger("COLORREF10", COLORREF10)
    WritePreferenceInteger("COLORREF11", COLORREF11)
    WritePreferenceInteger("COLORREF12", COLORREF12)
    WritePreferenceInteger("COLORREF13", COLORREF13)
    WritePreferenceInteger("COLORREF14", COLORREF14)
    WritePreferenceInteger("COLORREF15", COLORREF15)
    WritePreferenceInteger("COLORREF16", COLORREF16)
    ClosePreferences()
  Else   ;It exists, retrieve the GetUserColors.prefs information
    COLORREF1 = ReadPreferenceInteger("COLORREF1", COLORREF1)   ;The first user color
    COLORREF2 = ReadPreferenceInteger("COLORREF2", COLORREF2)
    COLORREF3 = ReadPreferenceInteger("COLORREF3", COLORREF3)
    COLORREF4 = ReadPreferenceInteger("COLORREF4", COLORREF4)
    COLORREF5 = ReadPreferenceInteger("COLORREF5", COLORREF5)
    COLORREF6 = ReadPreferenceInteger("COLORREF6", COLORREF6)
    COLORREF7 = ReadPreferenceInteger("COLORREF7", COLORREF7)
    COLORREF8 = ReadPreferenceInteger("COLORREF8", COLORREF8)
    COLORREF9 = ReadPreferenceInteger("COLORREF9", COLORREF9)
    COLORREF10 = ReadPreferenceInteger("COLORREF10", COLORREF10)
    COLORREF11 = ReadPreferenceInteger("COLORREF11", COLORREF11)
    COLORREF12 = ReadPreferenceInteger("COLORREF12", COLORREF12)
    COLORREF13 = ReadPreferenceInteger("COLORREF13", COLORREF13)
    COLORREF14 = ReadPreferenceInteger("COLORREF14", COLORREF14)
    COLORREF15 = ReadPreferenceInteger("COLORREF15", COLORREF15)
    COLORREF16 = ReadPreferenceInteger("COLORREF16", COLORREF16)
    ClosePreferences()
  EndIf
EndProcedure

Procedure ExitColorPrefs()
  If OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
    WritePreferenceInteger("COLORREF1", COLORREF1)   ;The first color
    WritePreferenceInteger("COLORREF2", COLORREF2)
    WritePreferenceInteger("COLORREF3", COLORREF3)
    WritePreferenceInteger("COLORREF4", COLORREF4)
    WritePreferenceInteger("COLORREF5", COLORREF5)
    WritePreferenceInteger("COLORREF6", COLORREF6)
    WritePreferenceInteger("COLORREF7", COLORREF7)
    WritePreferenceInteger("COLORREF8", COLORREF8)
    WritePreferenceInteger("COLORREF9", COLORREF9)
    WritePreferenceInteger("COLORREF10", COLORREF10)
    WritePreferenceInteger("COLORREF11", COLORREF11)
    WritePreferenceInteger("COLORREF12", COLORREF12)
    WritePreferenceInteger("COLORREF13", COLORREF13)
    WritePreferenceInteger("COLORREF14", COLORREF14)
    WritePreferenceInteger("COLORREF15", COLORREF15)
    WritePreferenceInteger("COLORREF16", COLORREF16)
    ClosePreferences()
   EndIf
EndProcedure

Procedure FullColorRequester()   ;Place CHOOSECOLOR Info into requester()
  Protected CHOOSECOLOR.CHOOSECOLOR, COLORREF.COLORREF
  
  InitColorPrefs()
  ;Place saved colors inside requester()
  COLORREF\RGB[0] = COLORREF1
  COLORREF\RGB[1] = COLORREF2
  COLORREF\RGB[2] = COLORREF3
  COLORREF\RGB[3] = COLORREF4
  COLORREF\RGB[4] = COLORREF5
  COLORREF\RGB[5] = COLORREF6
  COLORREF\RGB[6] = COLORREF7
  COLORREF\RGB[7] = COLORREF8
  COLORREF\RGB[8] = COLORREF9
  COLORREF\RGB[9] = COLORREF10
  COLORREF\RGB[10] = COLORREF11
  COLORREF\RGB[11] = COLORREF12
  COLORREF\RGB[12] = COLORREF13
  COLORREF\RGB[13] = COLORREF14
  COLORREF\RGB[14] = COLORREF15
  COLORREF\RGB[15] = COLORREF16
  
  CHOOSECOLOR\LStructSize = SizeOf(CHOOSECOLOR)
  CHOOSECOLOR\hwndOwner = 0   ;WindowID(#Window)
  CHOOSECOLOR\rgbResult = 0   ;Nothing selected
  CHOOSECOLOR\lpCustColors = COLORREF
  CHOOSECOLOR\flags = #CC_ANYCOLOR | #CC_FULLOPEN | #CC_RGBINIT
  
  If ChooseColor_(@CHOOSECOLOR)
     COLORREF1 =COLORREF\RGB[0]
     COLORREF2 =COLORREF\RGB[1]
     COLORREF3 =COLORREF\RGB[2]
     COLORREF4 =COLORREF\RGB[3]
     COLORREF5 =COLORREF\RGB[4]
     COLORREF6 =COLORREF\RGB[5]
     COLORREF7 =COLORREF\RGB[6]
     COLORREF8 =COLORREF\RGB[7]
     COLORREF9 =COLORREF\RGB[8]
     COLORREF10 =COLORREF\RGB[9]
     COLORREF11 =COLORREF\RGB[10]
     COLORREF12 =COLORREF\RGB[11]
     COLORREF13 =COLORREF\RGB[12]
     COLORREF14 =COLORREF\RGB[13]
     COLORREF15 =COLORREF\RGB[14]
     COLORREF16 =COLORREF\RGB[15]
    ExitColorPrefs()   ;Save info and Return Color Selected
    ProcedureReturn CHOOSECOLOR\rgbResult
  Else   ;No color was selected
    ExitColorPrefs()   ;Save info
    ProcedureReturn -1
  EndIf
EndProcedure

;Debug "Color Selected: " + FullColorRequester()
And It is inserted in SweetyVD with: If it suits you

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  XIncludeFile "FullColorRequester.pb"
CompilerEndIf

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  SelectedColor = FullColorRequester()
CompilerElse
  SelectedColor = ColorRequester()
CompilerEndIf

Re: Better ColorRequester()

Posted: Tue May 09, 2017 4:24 pm
by blueb
Great.
Thanks Chris. :)

The ability to easily control colors is an important part of a Visual Designer... and SweetyVD is turning out to be among the best.

Re: Better ColorRequester()

Posted: Tue May 09, 2017 10:38 pm
by kenmo
Nice tip, I learned a few things about the Windows color chooser now.

But why would you use 16 global COLORREF variables, instead of a global array sized 16 ?!? :)

Re: Better ColorRequester()

Posted: Tue May 09, 2017 11:06 pm
by blueb
kenmo wrote:Nice tip, I learned a few things about the Windows color chooser now.

But why would you use 16 global COLORREF variables, instead of a global array sized 16 ?!? :)
In hindsight... absolutely. At first I was only going to save one or two parameters, then got carried away with finishing it.

I did this in about an hour, and now I'm open to anyone helping with improvements. :mrgreen:

Re: Better ColorRequester()

Posted: Wed May 10, 2017 5:35 am
by davido
Very nice.
Thank you for sharing.

Re: Better ColorRequester()

Posted: Thu May 11, 2017 12:33 am
by ChrisR
I added the ColorRef array + the choice for the color window position (without a hook).
Can be usefull to get it closer to a color selector button.

Code: Select all

;==================================================================
; Author:     blueb
; Date:       May 8, 2017
; Explain:    Create a new ColorRequester that saves User Colors (between calls)
; Forum:      http://www.purebasic.fr/english/viewtopic.php?f=12&t=68450
; Saved as:   FullColorRequester.pb
; Addition:   ChrisR: COLORREF array + choose color window position
; --------------------------------------------------------------------------
; ChooseColor function:  https://msdn.microsoft.com/en-us/library/windows/desktop/ms646912%28v=vs.85%29.aspx
; CHOOSECOLOR Structure: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646830%28v=vs.85%29.aspx
;=========================================================

EnableExplicit
; --------------------------------------------------------------------------
; Goal - write a 'Unique' preference file in the temporary directory that 
; stays in the temporary directory even when user switches to other programs.
; It will keep the special colors the user last adjusted.
; --------------------------------------------------------------------------
Declare InitColorPrefs()
Declare ExitColorPrefs()
Declare FullColorRequester(Color, X = 0, Y = 0)

Structure COLORREF
  RGB.l[16]
EndStructure 

; Structure CHOOSECOLOR ; see PB toolbox
;      lStructSize.l
;      hwndOwner.i
;      hInstance.i
;      rgbResult.l
;      *lpCustColors
;      Flags.l
;      lCustData.i
;      *lpfnHook
;      *lpTemplateName
; EndStructure

; Needed for preferences file.
Global.i Dim COLORPREF(15)

Procedure InitColorPrefs()   ;Color Preference file - Storage information
  Protected I.l
  If OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs")   ;It exists, retrieve the GetUserColors.prefs information 
    For I = 0 To 15
      COLORPREF(I) = ReadPreferenceInteger("COLORREF"+Str(I+1), COLORPREF(I))
    Next
  Else   ; Does not exist, "GetUserColors.prefs" is erased. So create it with Default values
    CreatePreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
    For I = 0 To 15
      WritePreferenceInteger("COLORREF"+Str(I+1), COLORPREF(I))
    Next
    ClosePreferences()
  EndIf
EndProcedure

Procedure ExitColorPrefs()
  Protected I.i
  If OpenPreferences(GetTemporaryDirectory() + "GetUserColors.prefs")
    For I = 0 To 15
      WritePreferenceInteger("COLORREF"+Str(I+1), COLORPREF(I))
    Next
    ClosePreferences()
  EndIf
EndProcedure

Procedure FullColorRequester(Color, X = 0, Y = 0)   ;Place CHOOSECOLOR Info into requester()
  Protected CHOOSECOLOR.CHOOSECOLOR, COLORREF.COLORREF, hwnd.i, I.i
  hwnd = OpenWindow(#PB_Any, X, Y, 0, 0, "", #PB_Window_Invisible)
  InitColorPrefs()
  ;Place saved colors inside requester()
  For I = 0 To 15
    COLORREF\RGB[I] = COLORPREF(I)
  Next
  
  CHOOSECOLOR\LStructSize = SizeOf(CHOOSECOLOR)
  If IsWindow(hwnd)   ;Window Owner
    CHOOSECOLOR\hwndOwner = WindowID(hwnd)
  Else   ;No Owner
    CHOOSECOLOR\hwndOwner = 0
  EndIf
  CHOOSECOLOR\rgbResult = Color   ;Nothing selected
  CHOOSECOLOR\lpCustColors = COLORREF
  ;CHOOSECOLOR\flags = #CC_ANYCOLOR | #CC_RGBINIT
  CHOOSECOLOR\flags = #CC_FULLOPEN |#CC_ANYCOLOR | #CC_RGBINIT   ;#CC_FULLOPEN to display the additional controls
  
  If ChooseColor_(@CHOOSECOLOR)
    For I = 0 To 15
      COLORPREF(I) = COLORREF\RGB[I]
    Next
    ExitColorPrefs()   ;Save info and Return Color Selected
    If IsWindow(hwnd)
      CloseWindow(hwnd)
    EndIf
    ProcedureReturn CHOOSECOLOR\rgbResult
  Else   ;No color was selected
    ExitColorPrefs()   ;Save info
    If IsWindow(hwnd)
      CloseWindow(hwnd)
    EndIf
    ProcedureReturn -1
  EndIf
EndProcedure

CompilerIf (#PB_Compiler_IsMainFile)
  Define SelectedColor = FullColorRequester($804000, 100, 20)
  If SelectedColor = -1
    Debug "Canceled by user"
  Else
    Debug "Color Selected: " + SelectedColor
    Debug "Hex: " + "$" + RSet(Hex(Blue(SelectedColor)), 2, "0") + RSet(Hex(Green(SelectedColor)), 2, "0") + RSet(Hex(Red(SelectedColor)), 2, "0")   ;Hex value in BGR format
    Debug "RGB(" + Str(Red(SelectedColor)) + ", " + Str(Green(SelectedColor)) + ", " + Str(Blue(SelectedColor)) + ")"
  EndIf
CompilerEndIf
Note: #CC_FULLOPEN to display the additional controls but once expanded, we can not go back to display it non-expanded.
Edit: Add a parameter for the selected initial color

Re: Better ColorRequester()

Posted: Thu May 11, 2017 12:44 am
by blueb
Thanks Chris.. that's much cleaner! :)

Re: Better ColorRequester()

Posted: Thu May 11, 2017 2:19 am
by IdeasVacuum
Change RGB.l[16] to RGB.i[16] for x64

How can the requester window be initially displayed non-expanded?

Re: Better ColorRequester()

Posted: Thu May 11, 2017 8:44 am
by ChrisR
RGB.i[16] is changed in the code above :)

Remove #CC_FULLOPEN flag to display it non-expanded
CHOOSECOLOR\flags = #CC_ANYCOLOR | #CC_FULLOPEN | #CC_RGBINIT

ChooseColor function
CHOOSECOLOR structure

Re: Better ColorRequester()

Posted: Thu May 11, 2017 9:23 am
by Bisonte
IdeasVacuum wrote:Change RGB.l[16] to RGB.i[16] for x64
Ähem... Why ?

The RGB Value is always Long. 32 Bit. Also on x64 machines...