☎ +34 976 234 144

Un nuevo modo de usar el PageFrame

FoxPress n.º 141 · julio-agosto de 2006 · Por la Redacción de FoxPress

Artículo publicado en la revista FoxPress en julio-agosto de 2006. Algunos datos, versiones y funciones citados (MySQL, PHP, Visual FoxPro, Windows) pueden haber quedado desfasados.

Este PageFrame no tiene pestañas y produce el efecto de las hojas de un libro que se pasan. Cambiad el valor de joAt (que está en 10) y poned 16 o 24 para conseguir un efecto distinto.

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

¿Quieres llevar la IA a los datos de tu empresa?

En una auditoría gratuita de 30 minutos vemos qué caso concreto te ahorraría más trabajo.

Reservar mi auditoría →