Page 1 of 1

Posted: Mon Nov 25, 2002 1:02 am
by BackupUser
Restored from previous forum. Originally posted by Kale.

has anyone ever used the AnimateWindow_() winapi command with success?

--Kale

New to PureBasic and falling in Love! :)

Posted: Mon Nov 25, 2002 1:23 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

Kale, I found this code on Paul's resource site that works great.

Code: Select all

#AW_HOR_POSITIVE = $1 ;Animates the window from left To right. This flag can be used with roll Or slide animation.
#AW_HOR_NEGATIVE = $2 ;Animates the window from right To left. This flag can be used with roll Or slide animation.
#AW_VER_POSITIVE = $4 ;Animates the window from top To bottom. This flag can be used with roll Or slide animation.
#AW_VER_NEGATIVE = $8 ;Animates the window from bottom To top. This flag can be used with roll Or slide animation.
#AW_CENTER = $10      ;Makes the window appear To collapse inward If AW_HIDE is used Or expand outward If the AW_HIDE is not used.
#AW_HIDE = $10000     ;Hides the window. By default, the window is shown.
#AW_ACTIVATE = $20000 ;Activates the window.
#AW_SLIDE = $40000    ;Uses slide animation. By default, roll animation is used.
#AW_BLEND = $80000    ;Uses a fade effect. This flag can be used only If hwnd is a top-level window.


 
   
If OpenWindow(0,(GetSystemMetrics_(#SM_CXSCREEN)-318)/2,(GetSystemMetrics_(#SM_CYSCREEN)-220)/2, 318, 220, #PB_Window_SystemMenu|#WS_VISIBLE,"Window FX")
AnimateWindow_(WindowID(),200,#AW_HOR_POSITIVE|#AW_VER_POSITIVE)

  Repeat 
    EventID.l = WaitWindowEvent()   

  Until EventID = #PB_EventCloseWindow
  AnimateWindow_(WindowID(),200,#AW_BLEND | #AW_HIDE)
EndIf

End

Fangles woz ear orright den?

Posted: Mon Nov 25, 2002 11:09 pm
by BackupUser
Restored from previous forum. Originally posted by TheDanishGuy.

Hi there,

im currently working on a project which includes skinning and sliding "trays" ..... and tonight i got a bit closer by reading this toppic, - this is as fare as i got (just an example) by combining the great work of "Siegfried Rings" and from Paul´s site (credits due) - NB i did none of this programming, just combined the two, - you will probably need theese 2 files to see the end result :

http://www.reelmediaproductions.com/pb/ ... ndowfx.zip
http://www.reelmediaproductions.com/pb/ ... rskins.zip

Here is the code:

***************************************


#Width=350
#Height=260
X1=1
Y1=1
X2=#Width
Y2=#Height-160
X3=20
Y3=20

#AW_HOR_POSITIVE = $1 ;Animates the window from left To right. This flag can be used with roll Or slide animation.
#AW_HOR_NEGATIVE = $2 ;Animates the window from right To left. This flag can be used with roll Or slide animation.
#AW_VER_POSITIVE = $4 ;Animates the window from top To bottom. This flag can be used with roll Or slide animation.
#AW_VER_NEGATIVE = $8 ;Animates the window from bottom To top. This flag can be used with roll Or slide animation.
#AW_CENTER = $10 ;Makes the window appear To collapse inward If AW_HIDE is used Or expand outward If the AW_HIDE is not used.
#AW_HIDE = $10000 ;Hides the window. By default, the window is shown.
#AW_ACTIVATE = $20000 ;Activates the window.
#AW_SLIDE = $40000 ;Uses slide animation. By default, roll animation is used.
#AW_BLEND = $80000 ;Uses a fade effect. This flag can be used only If hwnd is a top-level window.


Structure SButton
Info.s
x1.l
y1.l
x2.l
y2.l
IMAGE1.l
IMAGE2.l
IMAGE3.l
State.l
EndStructure
Dim xButton.SButton(4)



Procedure WriteTitle(Info$)
;UseImage(7)
; StartDrawing(ImageOutput());
StartDrawing(WindowOutput())
x=#Width-TextLength(Info$)
x=x/2
DrawingMode(1)
; FrontColour(255,255,255)
Locate (x,4)
DrawText(Info$)
StopDrawing()

EndProcedure

Procedure TEXTXY(Info$,x1,y1,x2)
StartDrawing(WindowOutput())
x=x2-TextLength(Info$)
x=x/2
x=x+x1
DrawingMode(1)
; FrontColour(255,255,255)
Locate (x,y1+5)
DrawText(Info$)
StopDrawing()
EndProcedure


hwnd=OpenWindow(0,(GetSystemMetrics_(#SM_CXSCREEN)-318)/2,(GetSystemMetrics_(#SM_CYSCREEN)-220)/2, 318, 220, #PB_Window_SystemMenu|#WS_VISIBLE,"Window FX") ; This is the line i have added

AnimateWindow_(WindowID(),500,#AW_HOR_POSITIVE|#AW_slide) ; This is the line i have added

If hwnd
IMG1=LoadImage(1,"UL.bmp");Left Top Corner
IMG2=LoadImage(2,"UR.bmp");Right Top Corner
IMG3=LoadImage(3,"BL.bmp");Left Bottom Corner
IMG4=LoadImage(4,"BR.bmp");Right Bottom Corner
IMG5=LoadImage(5,"LS.bmp");Left Middle
IMG6=LoadImage(6,"RS.bmp");Right Middle
IMG7=LoadImage(7,"UM.bmp");Top Middle
IMG8=LoadImage(8,"BM.bmp");Bottom Middle
IMG9=LoadImage(9,"BACK.bmp");BackPicture
IMG10=LoadImage(10,"Button0.bmp");ButtonPicture Normal
IMG11=LoadImage(11,"Button1.bmp");ButtonPicture Pressed
IMG12=LoadImage(12,"Button2.bmp");ButtonPicture Hoover


CreateGadgetList(WindowID())
ImageGadget(80,1,0,25,25,IMG1);Left Top Corner
ImageGadget(81,#Width-71,0,20,20,IMG2);Right Top Corner

ImageGadget(82,1,#Height-10,11,9,IMG3);Left bottom Corner
ImageGadget(83,#Width-12,#Height-10,11,9,IMG4);right bottom corner

ImageGadget(84,1,71,20,#Width-160,IMG5);Left horizontal line
ResizeGadget(84,1,31,9,#Height-40)

ImageGadget(85,180,45,20,1,IMG6);Right horizontal line
ResizeGadget(85,#Width-9,31,8,#Height-31-9)

ImageGadget(86,25,0,200,15,IMG7) ;Top vertical line
ResizeGadget(86,71,0,#width-71-70,31)

ImageGadget(87,25,70,200,9,IMG8);Bottom vertical line
ResizeGadget(87,11,#Height-8,#Width-22,7)

ImageGadget(88,25,25,4,6,IMG9);Back
ResizeGadget(88,10,31,#Width-19,#Height-38)

ButtonGadget(88,#Width-20,5,17,17,"X")
ButtonGadget(89,#Width-40,5,17,17,"?")

For I=0 To 3
xButton(I)\x1=100
xButton(I)\y1=50+(I*30)
xButton(I)\x2=86
xButton(I)\y2=25
xButton(I)\IMAGE1=IMG10
xButton(I)\IMAGE2=IMG11
xButton(I)\IMAGE3=IMG12
Next
xButton(0)\Info="LOAD"
xButton(1)\Info="SAVE"
xButton(2)\Info="TOOL"
xButton(3)\Info="COOL"


For I= 0 To 3
ImageGadget(91+I,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2,xButton(I)\y2,xButton(I)\IMAGE1);Button
ResizeGadget(91+I,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2,xButton(I)\y2);Button
ImageGadget(91+I,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2,xButton(I)\y2,xButton(I)\IMAGE1);Button
ResizeGadget(91+I,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2,xButton(I)\y2);Button
Next

StringGadget(10,100,200,130,20,"Info")

Info$= "Skinexample 1.2 by S.Rings"

Repeat
EventID.l = WindowEvent()
x = WindowMouseX()
y = WindowMouseY()
Flag=0

;Or UserButtons
For I=0 To 3
If x>xButton(I)\x1 And xxButton(I)\y1 And y0
ImageGadget(91+I,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2,xButton(I)\y2,xButton(I)\IMAGE3);Button
xButton(I)\State=0
EndIf
EndIf
TEXTXY(xButton(I)\Info,xButton(I)\x1,xButton(I)\y1,xButton(I)\x2)
Next

If EventID = #WM_LBUTTONDOWN And Flag=0
ReleaseCapture_()
SendMessage_(hwnd,#WM_NCLBUTTONDOWN, #HTCAPTION,0)
WriteTitle(Info$)
EndIf
If EventID = #PB_EventCloseWindow ; If the user has pressed on the close button
AnimateWindow_(WindowID(),200,#AW_HIDE | #AW_HOR_NEGATIVE |#AW_slide) ; This is the line i have added
Quit = 1
EndIf
If EventID=#PB_EventGadget ;#PB_EventGadget
GadNR.l=EventGadgetID()
Select GadNR
Case 88
Quit=1
Case 89
MessageRequester("Info","Written in PureBasic",0)
EndSelect
EndIf
If EventID=#PB_EventREPAINT
Delay(5)
WriteTitle(Info$)
EndIf
If EventID=EventID=#PB_EventMoveWindow
Delay(5)
WriteTitle(Info$)
EndIf

Until Quit = 1
EndIf
End

*************************

My question is, - how do i get rid of the surrounding window when the screen appears, i only want the skinned one .... and how do i make it slide just as nicely IN as it does OUT ? , - when it slides out you can see the skinned interface dissapear... but the skinned interface doesnt appear on the IN before the window is complete

I hope this will inspire some people