Page 2 of 2

Posted: Sat Apr 12, 2008 4:31 pm
by UserOfPure
The bug is related to any use of #AW_BLEND. If I comment out the lines as shown in the code below, then everything works correctly here and I see the window and the other non-blend animations.

Code: Select all

If OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ;AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
  AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE)
  AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE)
  ;AnimateWindow_(WindowID(0), 1000, #AW_BLEND)
  ;AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
  AnimateWindow_(WindowID(0), 1000, #AW_CENTER)
  AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER)
  AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE)
  quit = 1
  Repeat
    event = WaitWindowEvent()
    If event = #PB_Event_CloseWindow
      quit = 1
    EndIf
  Until quit
EndIf
I see NetMaestro confirms the #AW_BLEND issue here -> http://www.purebasic.fr/english/viewtopic.php?t=31914
So you see -- I'm NOT stupid or doing anything wrong!!! :evil:

Posted: Sat Apr 12, 2008 4:35 pm
by Sparkie
@UserOfPure: What results are produced in the MessageRequester when you run this code. ?

Here are my results...

Window visibility = 101010101
8 successful transition(s)

Code: Select all

If OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  result.l = 0
  iwv$ = Str(IsWindowVisible_(WindowID(0)))
  If AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND) 
    result + 1
    iwv$ + Str(IsWindowVisible_(WindowID(0)))
    If AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE) 
      result + 1
      iwv$ + Str(IsWindowVisible_(WindowID(0)))
      If AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE) 
        result + 1
        iwv$ + Str(IsWindowVisible_(WindowID(0)))
        If AnimateWindow_(WindowID(0), 1000, #AW_BLEND) 
          result + 1
          iwv$ + Str(IsWindowVisible_(WindowID(0)))
          If AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND) 
            result + 1
            iwv$ + Str(IsWindowVisible_(WindowID(0)))
            If AnimateWindow_(WindowID(0), 1000, #AW_CENTER) 
              result + 1
              iwv$ + Str(IsWindowVisible_(WindowID(0)))
              If AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER) 
                result + 1
                iwv$ + Str(IsWindowVisible_(WindowID(0)))
                If AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE) 
                  result + 1
                  iwv$ + Str(IsWindowVisible_(WindowID(0)))
                EndIf
              EndIf
            EndIf
          EndIf
        EndIf
      EndIf
    EndIf
  EndIf
  MessageRequester("FYI", "Window visibility = " + iwv$ + #CRLF$ + Str(result) + " successful transition(s) ", #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
  quit.l = 1
  Repeat
    event = WaitWindowEvent()
    If event = #PB_Event_CloseWindow
      quit = 1
    EndIf
  Until quit
EndIf

Posted: Sat Apr 12, 2008 4:39 pm
by UserOfPure
My result with v4.20 Beta 4:

Code: Select all

---------------------------
FYI
---------------------------
Window visibility = 1
0 successful transition(s)
---------------------------
OK
---------------------------
And my result with v3.94 after adding the #AW_* constants and changing the window parameters around:

Code: Select all

---------------------------
FYI
---------------------------
Window visibility = 101010101
8 successful transition(s)
---------------------------
OK
---------------------------
Same PC, same hardware, same OS.

Update: I also get the v3.94 result with v4.20 Alpha 3, so something after Alpha 3 has affected the #AW_BLEND flag of AnimateWindow.

Posted: Sat Apr 12, 2008 5:16 pm
by Sparkie
I stand corrected, the results I posted were from PB4.10. :oops:

Using PB 4.20B4, I get the same faulty results as does UserOfPure.

(me thinks I have too many PB versions laying around....time for a little spring cleaning)

Posted: Sat Apr 12, 2008 5:18 pm
by UserOfPure
Sparkie wrote:Using PB 4.20B4, I get the same faulty results as does UserOfPure
Thank you!!!!!! :D

Posted: Sat Apr 12, 2008 5:21 pm
by Sparkie
You're welcome. :)

It is a nice feeling to know you're not alone in this world. 8)

Posted: Sat Apr 12, 2008 5:24 pm
by UserOfPure
Too right!!! I hate it when ppl don't believe you.

Posted: Sat Apr 12, 2008 6:09 pm
by Demivec
@Sparkie: Using PB 4.2B4, I ran your code that shows the MessageRequester and got the same results as you did, and also UserOfPure did. No surprise there.

I also did something that caused a slightly diffferent reaction. I setup a simple commentedASM tool (by srod) and ran it on the code (in PBv4.2b4) to see if I could spot something strange. The tool produces the commented assembly and loads it into Notepad, and as a side effect it runs the code also. When it did I got the results of "Window visibility = 10, 1 successful transition(s) :shock:. In other words it showed the first blend transition but no others. So it seems that when the commented assembly was loaded into Notepad as the program began its execution it seems to have temporarily averted the first failure of the function.

I don't have anything else to add, but it was an interresting observation.

Just for the record I'm running Windows XP sp2.

Posted: Sat Apr 12, 2008 7:28 pm
by Sparkie
When uisng #AW_HIDE | #AW_BLEND in PB 4.20B4, ShowWindow_() gets called, hiding the window before animation takes place.

When uisng #AW_HIDE | #AW_BLEND in PB 4.10, ShowWindow_() does not get called and window animation is a success.

Left click on the window to start animation.

Code: Select all

Procedure WinCallback(hwnd, msg, wParam, lParam)
  result = #PB_ProcessPureBasicEvents
  If msg = #WM_SHOWWINDOW
    If  wParam = 0
      If lParam = 0
        reason$ = "ShowWindow was called"
      EndIf
      MessageRequester("Info", "Window is about to be hidden" + #CRLF$ + "Reason: " + reason$, #MB_OK | #MB_ICONINFORMATION) 
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure
If OpenWindow(1,200,200,350,300,"Animation",#PB_Window_SystemMenu) 
  SetWindowCallback(@WinCallback())
  Repeat
    event = WaitWindowEvent()
    If event = #WM_LBUTTONDOWN
      AnimateWindow_(WindowID(1),2000,#AW_HIDE | #AW_BLEND)
      AnimateWindow_(WindowID(1),2000,#AW_BLEND)
      End
    EndIf
    
  Until event = #PB_Event_CloseWindow 
EndIf 

Posted: Sun Apr 13, 2008 2:21 am
by Sparkie
UserOfPure, does this work for you on PB 4.20B4...

Code: Select all

Procedure WinCallback(hwnd, msg, wParam, lParam) 
  Select msg 
    Case #WM_CLOSE 
      DestroyWindow_(hwnd) 
    Case #WM_DESTROY 
      PostQuitMessage_(0) 
      result  = 0 
    Default 
      result  = DefWindowProc_(hwnd, msg, wParam, lParam) 
  EndSelect 
  ProcedureReturn result 
EndProcedure 

wStyle  = #WS_BORDER | #WS_VISIBLE | #WS_OVERLAPPED | #WS_SYSMENU 
wExStyle = #WS_EX_LEFT | #WS_EX_LTRREADING | #WS_EX_RIGHTSCROLLBAR | #WS_EX_WINDOWEDGE
WindowClass.s  = "AnimateTest" 
wc.WNDCLASSEX 
wc\cbSize  = SizeOf(WNDCLASSEX) 
wc\hbrBackground = CreateSolidBrush_(GetSysColor_(#COLOR_3DFACE)) 
wc\hCursor = LoadCursor_(0, #IDC_ARROW) 
wc\lpfnWndProc  = @WinCallback() 
wc\lpszClassName  = @WindowClass 
RegisterClassEx_(@wc) 
  
hwnd = CreateWindowEx_(wExStyle, WindowClass, "Animation-Test", wStyle, 100, 100, 320, 240, 0, 0, 0, 0) 
If hwnd
  result.l = 0 
  If AnimateWindow_(hwnd, 1000, #AW_HIDE | #AW_BLEND) 
    result + 1 
    If AnimateWindow_(hwnd, 1000, #AW_SLIDE | #AW_HOR_POSITIVE) 
      result + 1 
      If AnimateWindow_(hwnd, 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE) 
        result + 1 
        If AnimateWindow_(hwnd, 1000, #AW_BLEND) 
          result + 1 
          If AnimateWindow_(hwnd, 1000, #AW_HIDE | #AW_BLEND) 
            result + 1 
            If AnimateWindow_(hwnd, 1000, #AW_CENTER) 
              result + 1 
              If AnimateWindow_(hwnd, 1000, #AW_HIDE | #AW_CENTER) 
                result + 1 
                If AnimateWindow_(hwnd, 1000, #AW_SLIDE | #AW_VER_POSITIVE) 
                  result + 1 
                EndIf 
              EndIf 
            EndIf 
          EndIf 
        EndIf 
      EndIf 
    EndIf 
  EndIf 
  MessageRequester("FYI", Str(result) + " successful transition(s) ", #PB_MessageRequester_Ok | #MB_ICONINFORMATION) 
  DestroyWindow_(hwnd)
  While GetMessage_(msg.MSG, #Null, 0, 0 ) 
    TranslateMessage_(msg) 
    DispatchMessage_(msg) 
  Wend 
EndIf

Posted: Sun Apr 13, 2008 2:40 am
by UserOfPure
Yes it does. But I don't expect to have to add all that extra code to do it, when v3.94 (and v4.20 A3) did it without. It's over to Fred. :)

Posted: Sun Apr 13, 2008 2:47 am
by Sparkie
Agreed 8)