This is the first time I've used a TIMER so I need some advice.
This code causes the LABEL with the %SS_NOTIFY style to initially draw one color
and turn to Red when the cursor is over it and the REDRAW turns it back to the
original color if that control no longer has the cursor over it.
Question: Does this use of the Timer cause any problems or is there a better
way of doing this.
Code:
In WM_INITDIALOG I have SetTimer(CBHNDL,1,100,BYVAL 0) --------------------------------------------------------------- Controls 1501 to 1520 are a range of labels with %SS_NOTIFY I use like buttons CASE %WM_TIMER FOR J = 1501 TO 1520 CONTROL HANDLE CBHNDL,J TO hctrl& IF hctrl& <> 0 THEN CONTROL REDRAW CBHNDL,J END IF NEXT In %WM_CTLCOLORSTATIC I have CASE 1501 TO 1520 SetBkMode CBWPARAM, %Transparent SetBkColor CBWPARAM, V_COLOR(15) IF GetDlgCtrlID(CBLPARAM) = CUR_CTRL_ID& THEN SetCursor HandMousePointer SelectObject CBWPARAM, hFontCap SetTextColor CBWPARAM, V_COLOR(4) ' change red when over ELSE SelectObject CBWPARAM, hFontCap SetTextColor CBWPARAM, V_COLOR(1) ' change back to blue END IF FUNCTION = GetStockObject(%NULL_BRUSH) In %WM_SETCURSOR I have CUR_CTRL_ID& = GetDlgCtrlID(CBWPARAM) IF CUR_CTRL_ID& >= 1501 AND CUR_CTRL_ID& <= 1520 THEN CONTROL HANDLE CBHNDL, CUR_CTRL_ID& TO CUR_CTRL& RedrawWindow CUR_CTRL&, BYVAL 0, 0, %RDW_ERASE OR %RDW_INVALIDATE PRESS_BUTTON_ON = -1: PRV_BUT& = CUR_CTRL& ELSEIF ABS(CUR_CTRL_ID&) > 100000& AND PRESS_BUTTON_ON THEN RedrawWindow PRV_BUT&, BYVAL 0, 0, %RDW_ERASE OR %RDW_INVALIDATE PRESS_BUTTON_ON = 0 END IF In WM_DESTROY I have KillTimer(CBHNDL,1)
and turn to Red when the cursor is over it and the REDRAW turns it back to the
original color if that control no longer has the cursor over it.
Question: Does this use of the Timer cause any problems or is there a better
way of doing this.
Comment