ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Un nouveau moyen d'utiliser le pageframe   



L'auteur

Mike Gagnon
Canada Canada
Membre Simple
# 0000000025
enregistré le 14/10/2004

Gagnon Mike
Pointe Cla H9R 3K8
de la société Carver Technologies Inc.
Fiche personnelle


Note des membres
20/20
1 vote


Contributions > 20 - Trucs et Astuces

Un nouveau moyen d'utiliser le pageframe
# 0000000113
ajouté le 01/12/2004 23:09:44 et modifié le 02/12/2004
consulté 8391 fois
Niveau initié

Version(s) Foxpro :
VFP 8.0
VFP 7.0
VFP 6.0

Description

Un nouvel effet obtenir d"un pageframe. Idéalement en changeant les pages, l'effet simule une page d'un livre qui tourne. Changez la valeur de joAt (qui est à 10) et mettez la a 16 ou 24 pour obtenir un effet différent.

Code source :
Public oForm1
oForm1=Createobject("form1")
oForm1.Show()
Define Class wbaniwindow As Custom
    Name = "wbaniwindow"
    Procedure wbaniwindow
    Lparameters toFormRef, tnAnimationType, tnDuration
    If Type('toFormRef')#'O' Or Isnull(toFormRef)
        Return 0
    Endif
    If Empty(tnAnimationType) Or Type('tnAnimationType') # 'N'
        tnAnimationType = 1
    Endif
    If Empty(tnDuration) Or Type('tnDuration') # 'N'
        tnDuration = 200
    Endif
    Local jnRez, jnHwnd

    Declare Integer AnimateWindow In WIN32API ;
        Integer HWnd, ;
        Integer dwTime, ;
        Integer dwFlags
    jnHwnd = 0
    If Substr(Version(4),1,2) => '07'
        jnHwnd = toFormRef.HWnd
    Else
        jnHwnd = This.F6GetHwnd(toFormRef)
    Endif
    jnRez = AnimateWindow(jnHwnd, tnDuration, tnAnimationType)
    toFormRef.Show()
    Return jnRez
Endproc
    Procedure F6GetHwnd
    Lparameter toForm
    Local jnHwnd
    Set Library To home()+"FoxTools.Fll" Additive
    jnHwnd = _WhToHwnd( _WFindTitl(toForm.Caption) )
    Return jnHwnd
Endproc
Enddefine
Define Class form1 As Form
    Procedure Load
    Create Cursor myCursor (Name c(20),address c(20),city c(20),state c(2),country c(20),zip c(10))
    Insert Into myCursor (Name,address,city,state,country,zip) Values ("Mike","123 nowhere","Nowhere","OH","USA","21342")
    Go Top
Endproc
Height = 320
Width = 400
AutoCenter = .T.
alwaysontop = .f.
MinButton = .F.
MaxButton = .F.
Caption = "Control animation"
    Procedure Init
    With This
        .AddObject("wbaniwindow1","wbaniwindow")
        .AddObject("pFrame","pFrame")
        .AddObject("c_group","c_group")
    Endwith
Endproc
BackColor = 15659506
Enddefine
Define Class pFrame As PageFrame
    PageCount = 3
    Visible = .T.
    Tabs = .F.
    Top= 20
    Left = 10
    Procedure Init
    With This
        .page1.BackColor = 15659506
        .page2.BackColor = 15659506
        .page3.BackColor = 15659506
    Endwith
    With This.page1
        .AddObject("textbox1","textbox")
        .textbox1.Visible = .T.
        .textbox1.Top = 30
        .textbox1.Left = 50
        .textbox1.ControlSource="myCursor.Name"
        .AddObject("textbox2","textbox")
        .textbox2.Visible = .T.
        .textbox2.Top = 30
        .textbox2.Left = 180
        .textbox2.ControlSource="myCursor.address"
    Endwith
    With This.page2
        .AddObject("textbox1","textbox")
        .textbox1.Visible = .T.
        .textbox1.Top = 30
        .textbox1.Left = 50
        .textbox1.ControlSource="myCursor.City"
        .AddObject("textbox2","textbox")
        .textbox2.Visible = .T.
        .textbox2.Top = 30
        .textbox2.Left = 180
        .textbox2.ControlSource="myCursor.state"
    Endwith
    With This.page3
        .AddObject("textbox1","textbox")
        .textbox1.Visible = .T.
        .textbox1.Top = 30
        .textbox1.Left = 50
        .textbox1.ControlSource="myCursor.Country"
        .AddObject("textbox2","textbox")
        .textbox2.Visible = .T.
        .textbox2.Top = 30
        .textbox2.Left = 180
        .textbox2.ControlSource="myCursor.zip"
    Endwith

Enddefine
Define Class c_group As CommandGroup
    nduration = 200
    nanimationtype = 1
    Visible = .T.
    AutoSize = .T.
    ButtonCount = 2
    BorderStyle = 0
    BackStyle = 0
    Value = 1
    Height = 37
    Width = 178
    Name = "c_group"
    Top = 272
    Left = 100
    Command1.Top = 5
    Command1.Left = 5
    Command1.Height = 27
    Command1.Width = 84
    Command1.Caption = "Previous"
    Command1.Name = "Command1"
    Command2.Top = 5
    Command2.Left = 89
    Command2.Height = 27
    Command2.Width = 84
    Command2.Caption = "Next"
    Command2.Name = "Command2"
    Procedure Command1.Click()
    Lparameters toFormRef, tnAnimationType, tnDuration
    toFormRef = Thisform
    tnAnimationType = 1
    tnDuration=220
    Local jnRez, joAni
    joAni = Createobject('wbAniWindow')
    jnRez = joAni.wbaniwindow(toFormRef, ;
        IIF(Empty(tnAnimationType),This.Parent.nanimationtype, tnAnimationType), ;
        IIF(Empty(tnDuration),This.Parent.nduration, tnDuration))
    Release joAni
    Return jnRez
Endproc
    Procedure Command1.Click
    If oForm1.pFrame.ActivePage > 1
        Local jnAt As Integer, jnRez As Integer, myForm As Object
        jnAt = 10
Define Window PaperPage At 1,1 Size 2,2 Name myForm
With myForm
    .Left = oForm1.Left+10
    .Top = oForm1.Top+40
    .Width = oForm1.pFrame.Width
    .Height = oForm1.pFrame.Height
    .caption = "ani"
    .titlebar = 0
Endwith
jnRez = This.Parent.Parent.wbAniWindow1.wbaniwindow(myForm, jnAt,400)
myForm.Release()
myForm = .F.
oForm1.pFrame.ActivePage=oForm1.pFrame.ActivePage-1
Endif
Endproc
    Procedure Command2.Click
    If oForm1.pFrame.ActivePage < oForm1.pFrame.PageCount
        Local jnAt As Integer, jnRez As Integer, myForm As Object
        jnAt = 10
        Define Window PaperPage At 1,1 Size 2,2 Name myForm
With myForm
    .Left = oForm1.Left+10
    .Top = oForm1.Top+40
    .Width = oForm1.pFrame.Width
    .Height = oForm1.pFrame.Height
    .caption = "ani"
    .titlebar = 0
Endwith
jnRez = This.Parent.Parent.wbAniWindow1.wbaniwindow(myForm, jnAt,400)
myForm.Release()
myForm = .F.
oForm1.pFrame.ActivePage=oForm1.pFrame.ActivePage+1
Endif
Endproc
Enddefine

Commentaires
le 18/04/2011, Olivier Hamou a écrit :
Pas mal du tout, on peut se faire un framework pour animer les fenetres comme sur un mac.

Merci à toi mike !

le 18/04/2011, Mike Gagnon a écrit :
Je ne connais pas assez le Mac pour te dire. Faudrait que je trouve quelqu'un avec un Mac :-)

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3