Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index
Message
De
11/08/2002 20:10:30
Hans-Otto Lochmann
Dr. Lochmann Consulting Gmbh
Frankfurt, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: Index
Divers
Thread ID:
00688398
Message ID:
00688456
Vues:
14
Hi Frederico,

> ...
>Anybody know how to build a progress bar when the program was run a INDEX command?
> ....


I assume, that you need something to show to the user, that the machine is still alive and your program is still running properly. Do you really need a progress bar for that?

Well, if you just need something to entertain your user while he/she waits, then a simple old-fashioned window might do it. This window takes the output of SET TALK . When the show is over this window disappears including all the messages of SET TALK. Also as SET TALK is build in and as you can control its verbosity with SET ODOMETER, you can easily control the overhead for entertaining your user.

You will find a sample function and some example calls below. Just test it with a "long" data file.

Hope this helps.

Hans.

-----------------------------
Set Path To Set("Path")+'<where you have it>'
USE (Home() + "\samples\tastrade\data\customer.dbf") IN 0 exclusive

= talkwind("Make an odd Index")
Index On company_name + contact_name + contact_title Tag ccc
= talkwind()

= talkwind('Find Customer with odd phone numbers', 's')
Select * from customer Into Cursor ccc Where At('5555',phone) > 0
= talkwind()


********************************************************************************
*-- Project........: General Purpose
*-- Procedure......: TalkWind.prg
*-- Purpose........: Generates, displays and destrroys a window to take the
*--                  output of SET TALK WINDOW TalkWind
*-- Author.........: Dr. Hans-Otto Lochmann
*-- Copyright......: (c) 2002; LF Management Consulting GmbH.
*--                  Freeware. You can use it "as is" at your own risk.
*--                  No warranty or liability whatsoever.
*-- Version........: 1.00
*-- First created..: October 21, 1995
*-- Last Update....: 2002/08/12 - put in some comments.
********************************************************************************
*--
*-- Usage / Calling Sequence.
*--   = talkwind ([tcCaption[, tcWinType]])
*--
*-- Example.
*--   = talkwind ('Get the best customers', 'SQL')
*--
*-- Result.
*--   No returnvalue.
*--
*-- Program abstract
*--   1. When called with at least the title parameter, then a window (in the
*--      old fashioned way is generated, to which the output of SET TALK ON
*--      is directed. Size of the window depends on tcWinType (see below).
*--   2. When called without a parameter the window "WTALK" is deleted and
*--      SET TALK OFF
*--
*-- Parameters,
*---  tcCaption = Title of the window
*--   tcWinType = permissabel values - fits to these commands
*--      "S", "s" OR "SQL-SELECT"
*--      "R", "r" OR "REPLACE", also good for INDEX and REINDEX
*--   -> "D", "d" OR "DELETE" (default), also good for COPY
*--      "C", "c" OR "COUNT"
*--
********************************************************************************

Function TalkWind

  Lparameters tcCaption, tcWinType

  Local lcSize As String
  Local lnCaptionLength As Integer
  Local lcMoveVertical As String

  If Pcount() = 0
    If Wexist( "WinTalk" )
      Release Window WinTalk
    Endif
    Set Talk Off
    Return
  Endif

  If Pcount() = 1
    lcSize = "SIZE 3,40"
    lnCaptionLength = 39
    lcMoveVertical = "0"
  Else
    Do Case
      Case Left( tcWinType, 1 ) $ "Ss" Or ;
          UPPER( tcWinType ) == "SQL-SELECT"
        lcSize = "SIZE 9,49"
        lnCaptionLength = 48
        lcMoveVertical = "-1"
      Case Left( tcWinType, 1 ) $ "Rr" Or ;
          UPPER( tcWinType ) == "REPLACE"
        lcSize = "SIZE 3,37"
        lnCaptionLength = 36
        lcMoveVertical = "0"
      Case Left( tcWinType, 1 ) $ "Dd" Or ;
          UPPER( tcWinType ) == "DELETE"
        lcSize = "SIZE 3,30"
        lnCaptionLength = 29
        lcMoveVertical = "0"
      Case Left( tcWinType, 1 ) $ "Cc" Or ;
          UPPER( tcWinType ) == "COUNT"
        lcSize = "SIZE 3,21"
        lnCaptionLength = 20
        lcMoveVertical = "0"
      Otherwise
        lcSize = "SIZE 3,40"
        lnCaptionLength = 39
        lcMoveVertical = "0"
    Endcase
  Endif

  If Len( tcCaption ) = 0
    l_istitel = "Please wait"
  Else
    If Len( tcCaption ) > lnCaptionLength
      l_istitel = Left( tcCaption, lnCaptionLength)
    Else
      l_istitel = tcCaption
    Endif
  Endif

  If Wexist( "WinTalk" )
    Release Window WinTalk
  Endif

  Set Talk On

Define Window WinTalk   ;
  FROM 1,1 &lcSize  ;
  FONT "Fixedsys", 9 ;
  TITLE "&l_istitel" ;
  DOUBLE  ;
  NOCLOSE ;
  NOFLOAT ;
  NOGROW  ;
  NOZOOM

Activate Window WinTalk Noshow
Move Window WinTalk Center
Move Window WinTalk By &lcMoveVertical, 0
Activate Window WinTalk
Set Talk Window WinTalk

Return 
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform