![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
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 |
#12
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |