' -- RapidQ Basic listing created with SYN2HTML.VDM 'Eye Candy 'By Achilles B. Mina 'On the surface just eye candy, but also demonstrates a visually graceful 'way to fade in or out a window, especially a child window. The fades can 'be combined to create new fade effects Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation. Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation. Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation. Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation. Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown. 'Const AW_ACTIVATE = &H20000 'Activates the window. 'Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used. 'Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window. DECLARE FUNCTION AnimateWindow Lib "user32" Alias "AnimateWindow"(hwnd As Long, dwTime As Long, dwFlags As Long) As Integer DECLARE SUB Animate(Sender AS QCOOLBTN) CREATE Q AS QFORM Caption = "Eye Candy" Color = &HEEFAFA CREATE Qb AS QFORM Color = &HAAFDFD END CREATE CREATE B1 AS QCOOLBTN Top = 20 Left = 5 Width = 300 Flat = 1 Caption = "Horizontal fade, left to right" OnClick = Animate END CREATE CREATE B2 AS QCOOLBTN Top = 50 Left = 5 Width = 300 Flat = 1 Caption = "Horizontal fade, right to left" OnClick = Animate END CREATE CREATE B3 AS QCOOLBTN Top = 80 Left = 5 Width = 300 Flat = 1 Caption = "Vertical fade, top to bottom" OnClick = Animate END CREATE CREATE B4 AS QCOOLBTN Top = 110 Left = 5 Width = 300 Flat = 1 Flat = 1 Caption = "Vertical fade, bottom to top" OnClick = Animate END CREATE CREATE B5 AS QCOOLBTN Top = 140 Left = 5 Width = 300 Flat = 1 Caption = "Fade outward" OnClick = Animate END CREATE CREATE B6 AS QCOOLBTN Top = 170 Left = 5 Width = 300 Flat = 1 Caption = "Fade inward" OnClick = Animate END CREATE END CREATE Q.Showmodal SUB Animate(Sender AS QCOOLBTN) SELECT CASE Sender.Caption CASE "Horizontal fade, left to right" AnimateWindow Qb.Handle, 300, AW_HOR_POSITIVE CASE "Horizontal fade, right to left" AnimateWindow Qb.Handle, 300, AW_HOR_NEGATIVE CASE "Vertical fade, top to bottom" AnimateWindow Qb.Handle, 300, AW_VER_POSITIVE CASE "Vertical fade, bottom to top" AnimateWindow Qb.Handle, 300, AW_VER_NEGATIVE CASE "Fade outward" AnimateWindow Qb.Handle, 300, AW_CENTER CASE "Fade inward" Qb.Visible = 1 AnimateWindow Qb.Handle, 300, AW_CENTER OR AW_HIDE END SELECT IF Qb.Visible = 1 THEN Qb.Visible = 0 ELSE Qb.Visible = 1 Qb.Visible = 0 END IF END SUB