dbTalk Databases Forums  

Invoke color picker in code with Access 2003?

comp.databases.ms-access comp.databases.ms-access


Discuss Invoke color picker in code with Access 2003? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Salad
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 05:15 PM






PW wrote:

Quote:
On Thu, 23 Apr 2009 11:56:27 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:


PW wrote:

Nevermind! I converted it to 2003 and I can look at the code. Thanks
again.

-pw

You're welcome. It seems to work just fine.


I'm struggling a little bit with the instructions on how to return a
value to the form so I can change the RGB colors of controls. Don't
quite understand what the function is supposed to contain:


' If you want this Function to simply Return
' the Value of the Color the user selected
' from the Dialog just change the Function
' Declaration in modColorPicker to something like:
'Public Function DialogColor(ctl As Control) As Long
' Remember to add the line of code at the
' end of the Function
'DialogColor = CS.rgbResult



' Then call it from your Form with code like:

'***Code Start
'Private Sub CmdChooseBackColor_Click()
' Pass the TextBox Control to the function
'Me.textCtl.BackColor = DialogColor(Me.textCtl)
'End Sub

I added this function...nearly the same as aDialogColor to the module.

Public Function DialogColor() As Long
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long

CS.lStructSize = Len(CS)
CS.hwnd = hWndAccessApp
CS.Flags = CC_SOLIDCOLOR
CS.lpCustColors = String$(16 * 4, 0)
x = ChooseColor(CS)

If x = 0 Then
DialogColor = -1
Else
' Normal processing
DialogColor = CS.rgbResult
End If
End Function

In Debug window I entered
? DialogColor()
and it returned the number value. If cancel was selected, I returned a
negative 1.




Reply With Quote
  #12  
Old   
PW
 
Posts: n/a

Default Re: Invoke color picker in code with Access 2003? - 04-23-2009 , 06:46 PM






On Thu, 23 Apr 2009 15:15:41 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:

Quote:
PW wrote:

On Thu, 23 Apr 2009 11:56:27 -0700, Salad <oil (AT) vinegar (DOT) com> wrote:


PW wrote:

Nevermind! I converted it to 2003 and I can look at the code. Thanks
again.

-pw

You're welcome. It seems to work just fine.


I'm struggling a little bit with the instructions on how to return a
value to the form so I can change the RGB colors of controls. Don't
quite understand what the function is supposed to contain:


' If you want this Function to simply Return
' the Value of the Color the user selected
' from the Dialog just change the Function
' Declaration in modColorPicker to something like:
'Public Function DialogColor(ctl As Control) As Long
' Remember to add the line of code at the
' end of the Function
'DialogColor = CS.rgbResult



' Then call it from your Form with code like:

'***Code Start
'Private Sub CmdChooseBackColor_Click()
' Pass the TextBox Control to the function
'Me.textCtl.BackColor = DialogColor(Me.textCtl)
'End Sub


I added this function...nearly the same as aDialogColor to the module.

Public Function DialogColor() As Long
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long

CS.lStructSize = Len(CS)
CS.hwnd = hWndAccessApp
CS.Flags = CC_SOLIDCOLOR
CS.lpCustColors = String$(16 * 4, 0)
x = ChooseColor(CS)

If x = 0 Then
DialogColor = -1
Else
' Normal processing
DialogColor = CS.rgbResult
End If
End Function

In Debug window I entered
? DialogColor()
and it returned the number value. If cancel was selected, I returned a
negative 1.

Ain't that slick! Cool! Now I have to check if I can use a value
rather than RGB().

I am using DBI-Tech's Solution Schedule for our calendars as:

' Blue bar for real hold

intBarStyleBlue = .AddBarStyle(20, 1)
.StyleFillType(intBarStyleBlue) = 0
.StyleBackColor(intBarStyleBlue) = RGB(206, 206, 255)
.StyleBorderColor(intBarStyleBlue) = RGB(79, 79, 255)


-paul


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.