Page 1 of 2

Windows transitions

Posted: Tue Nov 02, 2004 5:49 pm
by marvin
Any one know how to use or code windows transitions for like a slide show.

Thanks

Posted: Wed Nov 03, 2004 2:59 am
by Sparkie
Do a search for AnimateWindow and you'll find a few examples. Here's a quick snippet to get you started. :)

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
*** Edit to update code to PB4.x

Posted: Sat Apr 12, 2008 5:30 am
by UserOfPure
None of Sparkie's code works with v4.20 Beta 4. When I run it, I never see a window at all. Using XP and yes I changed the "Test" parameter to the correct place. ;) It all works fine with v3.94 though.

Posted: Sat Apr 12, 2008 5:35 am
by ts-soft
Change this:

Code: Select all

OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
The example is for PB3.xx not for PB4.xx

Posted: Sat Apr 12, 2008 5:41 am
by UserOfPure
I did. Read my post again. And besides, the bug is the very fact the window transitions work only with v3.94 and not v4.20 -- that's the point.

Posted: Sat Apr 12, 2008 5:50 am
by Rook Zimbabwe
Works fine in PB4.3 - if you replace Sparkies window line wit TS-Softs!

Posted: Sat Apr 12, 2008 5:53 am
by UserOfPure
I did. Read my post again.

Posted: Sat Apr 12, 2008 5:54 am
by Rook Zimbabwe
I ran it fine in 4.2b2 as well.

Code: Select all

#AW_ACTIVATE = $20000 
#AW_BLEND = $80000 
#AW_CENTER = $10 
#AW_HIDE = $10000 
#AW_HOR_NEGATIVE = 2 
#AW_HOR_POSITIVE = 1 
#AW_SLIDE = $40000 
#AW_VER_NEGATIVE = 8 
#AW_VER_POSITIVE = 4 
OpenWindow(0, 10, 10, 300, 200, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

Repeat

AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND) 
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_HOR_POSITIVE) 
SendMessage_(WindowID(0), #WM_PAINT, 0, 0) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_BLEND) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_CENTER) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER) 
Delay(1000) 
AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE) 
Delay(1000) 

Until Event = #PB_Event_CloseWindow

End
The close window event will only owrk if the window is open... I reccomend killing it in the compiler. 8)

Posted: Sat Apr 12, 2008 5:59 am
by ts-soft
@UserOfPure
It works on PB4.20 beta 4

Minimize the PB-Ide after start to see the result!

Posted: Sat Apr 12, 2008 6:00 am
by Rook Zimbabwe
He has already started two bug reports on this.

Posted: Sat Apr 12, 2008 6:24 am
by UserOfPure
ts-soft wrote:Minimize the PB-Ide after start to see the result!
Tried that, and still nothing. All I get is a button in the Taskbar. I'm using v4.20 Beta 4 too. I'm not stupid.

Posted: Sat Apr 12, 2008 6:42 am
by ts-soft
Test this please:

Code: Select all

Procedure CreateShellObject()
  Protected obj.l, hResult.l

  CoInitialize_(#Null)
  hResult = CoCreateInstance_(?CLSID_Shell_Application, 0, 1, ?IID_IShellDispatch, @obj)

  If Not hResult
    ProcedureReturn obj
  Else
    ProcedureReturn #False
  EndIf

  DataSection
    CLSID_Shell_Application:  ; {13709620-C279-11CE-A49E-444553540000}
    Data.l $13709620
    Data.w $C279,$11CE
    Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
    IID_IShellDispatch:  ; {D8F015C0-C278-11CE-A49E-444553540000}
    Data.l $D8F015C0
    Data.w $C278,$11CE
    Data.b $A4,$9E,$44,$45,$53,$54,$0,$0
  EndDataSection
EndProcedure

Procedure ReleaseShellObject(obj.l)
  Protected object.IUnknown = obj
  object\Release()
EndProcedure

Define.IShellDispatch shell

shell = CreateShellObject()
If shell
  shell\MinimizeAll()       ; alle Fenster minimieren

  #AW_ACTIVATE = $20000
  #AW_BLEND = $80000
  #AW_CENTER = $10
  #AW_HIDE = $10000
  #AW_HOR_NEGATIVE = 2
  #AW_HOR_POSITIVE = 1
  #AW_SLIDE = $40000
  #AW_VER_NEGATIVE = 8
  #AW_VER_POSITIVE = 4
  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)
  SendMessage_(WindowID(0), #WM_PAINT, 0, 0)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_SLIDE | #AW_HOR_POSITIVE)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_BLEND)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_BLEND)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_CENTER)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_HIDE | #AW_CENTER)
  Delay(1000)
  AnimateWindow_(WindowID(0), 1000, #AW_SLIDE | #AW_VER_POSITIVE)
  Delay(1000)

  shell\UndoMinimizeALL()   ; minimieren rückgängig machen

  ReleaseShellObject(shell)
EndIf

Posted: Sat Apr 12, 2008 6:53 am
by UserOfPure
Yes, that works perfectly now (except for the #AW_BLEND animation, which still fails). I get a window in the center of the screen doing all the animations. But it's still a bug if v3.94 did it but v4.20 doesn't (on all PCs, that is). And who wants to minimize all windows to do it, when v3.94 didn't have to?

Posted: Sat Apr 12, 2008 3:46 pm
by Demivec
UserOfPure wrote:Yes, that works perfectly now (except for the #AW_BLEND animation, which still fails). I get a window in the center of the screen doing all the animations. But it's still a bug if v3.94 did it but v4.20 doesn't (on all PCs, that is). And who wants to minimize all windows to do it, when v3.94 didn't have to?
What would the bug be? All the code posted use mainly API functions.

I ran the example ts-soft posted and it worked with v4.1 and I didn't have to manually minimize any windows (using jaPBe).

Since you're a user of PureBasic, write the code so it does things the way you want it to be done. It's not a bug because an example written for someone else doesn't satisfy your needs.:wink:

Posted: Sat Apr 12, 2008 3:59 pm
by Sparkie
I've edited my orignal code to be PB4.x compliant.