Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Autocenter Wait window
Message
From
23/06/2006 07:44:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/06/2006 03:52:09
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MySQL
Miscellaneous
Thread ID:
01131048
Message ID:
01131078
Views:
19
>Hello Everybody
>
>From my screens i call some functions which display a wait window to inform the user whats going on and than clear the wait.
>
>
>Wait "Data is searched! Be patient!" window at nn,yy nowait noclear
>=sqlexec .....
>wait clear
>
>
>Is it possible to "autocenter" these WaitWindows ??? (Middle line of form?)
>
>Any help welcomed
>
>Best regards
>Albert

Albert,
I use something similar to this:
Public oForm
oForm = Createobject('myForm')
oForm.Show()

Define Class myForm As Form
  oWaitWindow = .Null.
  AutoCenter = .T.
  Add Object cmdWait As CommandButton ;
    With Caption ="WaitWindow",Left = 5, Top = 5, AutoSize = .T.

  Procedure Init
    This.oWaitWindow=Createobject('myWaitWindow')
  Endproc

  Procedure WaitWindow
    Lparameters tcMessage
    This.oWaitWindow.SetText(m.tcMessage,This)
  Endproc

  Procedure cmdWait.Click
    Thisform.WaitWindow("Data is searched! Be patient!")

* My long process
    ltStart = Datetime()
    Do While Datetime()<m.ltStart + 5
    Enddo

* Yet another wait state
TEXT to thankyou noshow
Done searching. Thank you for your patience.
Foxpro is fast and I'll be checking if this might be faster.
ENDTEXT

    Thisform.WaitWindow(m.thankyou)

    ltStart = Datetime()
    Do While Datetime()<m.ltStart + 5
    Enddo

    Thisform.oWaitWindow.Hide()
  Endproc
Enddefine

Define Class myWaitWindow As Form
  AlwaysOnTop=.T.
  BackColor=0xE0FFFF
  BorderStyle=1
  ShowWindow=1
  TitleBar=0
  Visible = .F.
  Add Object edtMessage As EditBox ;
    with BackStyle=0,BorderStyle=0,DisabledForeColor=0,;
    enabled=.F.,ScrollBars=0,SpecialEffect=0,IntegralHeight=.T.

  Procedure SetText
    Lparameters tcMessage,toForm,tnPos
    Local Array aMsgLines[1]
    Local lnLines,lnMax,ix
    tnPos = Iif(Empty(m.tnPos),0,m.tnPos) && default 0 autocenter,1-TL,2-TR,3-BL,4-BR
    lnLines = Alines(aMsgLines,m.tcMessage,.T.)
    lnMax = 0
    For ix=1 To m.lnLines
      lnMax = Max(m.lnMax,This.TextWidth(aMsgLines[m.ix]))
    Endfor
    With This
      .LockScreen = .T.
      .edtMessage.Value = m.tcMessage
      Store m.lnLines*.TextHeight('X')+5 To .Height,.edtMessage.Height
      Store m.lnMax+Sysmetric(10)*2+5    To .Width, .edtMessage.Width
      If Type('toForm')='O' And !Isnull(toForm)

        Do Case
          Case m.tnPos=0 && center
            .Move(toForm.Left+(toForm.Width-.Width)/2,;
              toForm.Top+(toForm.Height-.Height)/2)
          Case m.tnPos=1 && TopLeft
            .Move(toForm.Left,;
              toForm.Top)
          Case m.tnPos=2 && TopRight
            .Move(toForm.Left+toForm.Width-.Width,;
              toForm.Top)
          Case m.tnPos=3 && BottomLeft
            .Move(toForm.Left,;
              toForm.Top+toForm.Height-.Height)
          Case m.tnPos=4 && BottomRight
            .Move(toForm.Left,;
              toForm.Top+toForm.Height-.Height)
        Endcase
      Endif
      .Show()
      .LockScreen = .F.
    Endwith
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform