I put an up-down control on a form and simply want to respond to whether the up or down
arrow got pressed.
FF created :
FUNCTION FORM2_UPDOWN1_CUSTOM ( _
ControlIndex AS LONG, _ ' index in Control Array
hWndForm AS DWORD, _ ' handle of Form
hWndControl AS DWORD, _ ' handle of Control
wMsg AS LONG, _ ' type of message
wParam AS DWORD, _ ' first message parameter
lParam AS LONG _ ' second message parameter
) AS LONG
DIM pNMUD AS NM_UPDOWN PTR
DIM wrkCurrent AS LONG
DIM wrk AS STRING
DIM cnt AS LONG
DIM tbl(5) AS STRING
DIM x AS LONG
DIM fldRec AS FIELD
IF wMsg = %WM_NOTIFY THEN
BEEP
IF hWndControl = HWND_FORM2_UPDOWN1 THEN
pNMUD = lParam
IF @pNMUD.hdr.code = %UDN_DELTAPOS THEN
wrkCurrent = RtrnCurrent
IF @pNMUD.iDelta = -1 THEN
DECR wrkCurrent
IF wrkCurrent < 1 THEN
wrkCurrent = RtrnMax
END IF
ELSE
INCR wrkCurrent
IF wrkCurrent > RtrnMax THEN
wrkcurrent = 1
BEEP
END IF
END IF
... and so on
but it never beeps. The other posts in this forum keep talking only about some slider/scrolling
type of control and that confuses me to no end.
I'm guessing that I need to respond to a WM_NOTIFY msg but as I said it never beeps.
So what msg should I be checking for and do I need to check for a particular control handle?
I've only got the 1 up-down control. I'm very confused when trying to match up what is on
the PB forums with what FF wants.
Thanks.
The problem is that you are trying to catch the WM_NOTIFY in the CUSTOM handler for the UpDown control.... you should use the CUSTOM handler of the Form.
Function FORM1_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Local pUpDown As NM_UPDOWN Ptr
Select Case wMsg
CASE %WM_NOTIFY
pUpDown = lParam
If @pUpDown.hdr.idFrom = IDC_FORM1_UPDOWN1 Then
If @pUpDown.hdr.code = %UDN_DELTAPOS Then
If @pUpDown.iDelta = -1 Then
MsgBox "DOWN"
Else
MsgBox "UP"
End If
End If
End If
End Select
End Function
Ok, I was going by what routine FF sent me to when I double clicked the control.
Thanks.
:) No problem.
You just need to keep in mind that notification messages get sent to the parent of the specified control. In this case, the parent of the UpDown control is the Form.
(I shouldn't tell you but when I was working on your problem, I copied your code and spent about 10 minutes scratching my head wondering why it would work.... I checked all styles, searched the Net, searched POFFS.... any finally it struck me that the code was in the wrong CUSTOM handler) :D