To Uwe: I need your help on this.

To Uwe: I need your help on this.

Postby HunterEC » Mon Jan 02, 2012 12:11 am

Uwe:

On the following code, can you show me why the meter does not paint ? Thank you.
Code: Select all  Expand view

FUNCTION Main
.
.
.
MsgMeter( { | oMeter, oText, oDlg, lEnd | CreateTag( OMeter, oText, oDlg, @lEnd, "Name", "Field1") },;
                "Mantenimiento ..." )
.
.
.
RETURN



PROCEDURE CreateTag (OMeter, oText, oDlg, lEnd, cTagName, cKey, cCondition, lDescend)
   *
   * This PROCEDURE creates index TAGs.
   *
   MEMVAR cKeyField, cForCond

   PRIVATE cKeyField, cForCond

   IF VALTYPE(lDescend) != "L"
      lDescend := .F.
   ENDIF
   cKeyField := cKey

   oMeter:nTotal := (LASTREC())

   IF cCondition != NIL
      cForCond := cCondition
      IF ! lDescend
         INDEX ON &cKeyField TAG (cTagName) FOR &cForCond EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )
      ELSE
         INDEX ON &cKeyField TAG (cTagName) FOR &cForCond EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd ) ;
                  DESCENDING
      ENDIF
   ELSE
      IF ! lDescend
         INDEX ON &cKeyField TAG (cTagName) EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )
      ELSE
         INDEX ON &cKeyField TAG (cTagName) EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd ) ;
               DESCENDING
      ENDIF
   ENDIF
RETURN
* EOP: CreateTag

 
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Uwe: I need your help on this.

Postby ukoenig » Mon Jan 02, 2012 3:44 pm

Image

A little Sample ( maybe it helps )
The selected Index is shown in a Browser :
( I increased the DBF 4 times, the is the reason of the 4 equal records )

Code: Select all  Expand view

#INCLUDE "FIVEWIN.CH"
#include "tselex.ch"

FUNCTION MAIN()
LOCAL oDlg, oMeter, oButton, nRecords, nActual := 0, oSelect, nOption, cTag := "Last", oFont

REQUEST DBFCDX
RDDSETDEFAULT( "DBFCDX" )

USE Customer
nRecords = RecCount()

oFont  := TFont():New("Arial",,-14,.F.,.F. ,,,,.F. )

DEFINE DIALOG oDlg FROM 30, 30 TO 200, 400  PIXEL TRANSPARENT

@ 15, 20 METEREX oMeter VAR nActual SIZE 140, 20 TOTAL nRecords PIXEL;
GRADIENT TRACK { { 1/2, nRGB( 198, 203, 213 ), nRGB( 219, 224, 233 ) },;
                                   { 1/2, nRGB( 224, 238,237 ), nRGB( 224, 238,237 ) } } ;
LINECOLORS nRGB( 110, 151,204 ), CLR_WHITE INVERTED

@ 45, 90 SELEX oSelect VAR nOption SIZE 90, 30 OF oDlg PIXEL ;
ITEMS "&Last", "&Street", "&City";
GRADIENT OUTTRACK { { 0.5, 16443068, 16312263 }, ;
                       { 0.5, 16312263, 16443068 } } ;
GRADIENT INTRACK { { 1, 5426223, 1071100 }, ;
                      { 1, 1071100, 5426223 } } ;
THUMBSIZE 20, 25 ROUNDSIZE 5 ;
COLOR THUMB 14853684 ;
COLORTEXT 128, 32768 ;
TITLE "Select Index" TOP ;
FONT oFont ;
ACTION(  IIF( nOption = 1,  cTag := "Last", NIL ), ;
         IIF( nOption = 2,  cTag := "Street", NIL ), ;
         IIF( nOption = 3,  cTag := "City", NIL ) )  

@ 45 , 15 BUTTON oButton PROMPT "Start Meter" ;
ACTION  ( CreateTag( oMeter, @nActual, "Test", cTag ), BROWSE() ) PIXEL

ACTIVATE DIALOG oDlg

USE
oFont:End()

RETURN NIL

// ----------------------

FUNCTION CreateTag( oMeter, nActual, cCdxName, cKey )

oMeter:nTotal = RecCount()

INDEX ON cKey TO &cCdxName ;
EVAL ( oMeter:Set( RecNo() ) )

nActual = oMeter:nTotal
oMeter:Set( nActual )
 
SysRefresh()  

SET ORDER TO TAG &cKey
GO TOP

RETURN NIL
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: To Uwe: I need your help on this.

Postby HunterEC » Mon Jan 02, 2012 11:49 pm

Uwe:

Thank you for your response. My firend: how do I adapt your code so it works automatically ? No need to press a button to begin the indexing procedure ?
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Uwe: I need your help on this.

Postby ukoenig » Tue Jan 03, 2012 2:31 pm

Moving the Index-call to Dialog ON INIT, doesn't need a Button-action.

ACTIVATE DIALOG oDlg ;
ON INIT ( CreateTag( oMeter, @nActual, "Test", cTag ) ) // , BROWSE() )


There is still another way to create a Index :
Samples :
Code: Select all  Expand view

ORDCREATE( ,"FAKT1","LOWER(archiv) + DESCEND(str(year) + STR(month) + number)", ;
                  {|| LOWER(archiv) + DESCEND(str(year) + STR(month) + number) } , .T. )

ORDCREATE( ,"FAKT2","LOWER(archiv) + DESCEND(str(year) + STR(month) + number)", ;
      {|| LOWER(archiv) + DESCEND(str(year) + STR(month) + number) } , .F. )    
     
ORDCONDSET( , , , , , , , , , , .T. )      // descend
ORDCREATE( ,"FAKT3","STR(year) + number + archiv", ;
                  {|| STR(year) + number + archiv } , .T. )
 


I started, to creat a better looking Solution : a combination of TTitle and METEREX
with additional Image and DBF-infos : Name and Records ( maybe still the created Index ).
A click on the Image can open a Info-box about the DBF.

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 118 guests