How do I stop after the progress bar demonstration?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

How do I stop after the progress bar demonstration?

#1 Post by Eugene Lutsenko »

hi!
How do I stop after the progress bar demonstration? Everything works correctly for me, except for the very end. Everything should stop and wait for pressing the "Ok" key, and only then disappear from the screen.

Code: Select all

   Caption = L("Расчет матриц сходства, кластеров и конструктов классов завершен успешно !!!")
   oSay97:SetCaption(oSay97:Caption)
   oButton:SetCaption('&Ok')     // Деструктурирование окна отображения графического Progress-bar
   oButton:activate := {||PostAppEvent(xbeP_Close,,,oDialog)}  //<<<<<< Add This
   DC_AppEvent( @lOk )
*  MILLISEC(5000)
   oDialog:Destroy()

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How do I stop after the progress bar demonstration?

#2 Post by rdonnay »

This is the sample from XSample1.prg in \exp20\samples\xdemo.

It stops at the end and requires that you click OK.

Code: Select all

STATIC FUNCTION XSample_14
/*
PROGRESS BAR

This example demonstrates a progress bar that is displayed
while copying records from a database.   The CANCEL button
can be used to cancel the copy while in progress.
*/

LOCAL Getlist := {}, oProgress, oDialog, lOk := .t., oButton, ;
      nEvent, mp1, mp2, oXbp

USE ..\XDOC\EXPRESS VIA FOXCDX ALIAS XDOC

@ 2,5 DCSAY 'Exporting Data to JUNK.DBF'

@ 4,5 DCPROGRESS oProgress ;
       SIZE 55,1.5 ;
       PERCENT ;
       EVERY 5 ;
       MAXCOUNT RecCount() COLOR GRA_CLR_BLUE

@ 4,65 DCPUSHBUTTON  CAPTION '&Cancel' ;
  ACTION {||lOk:=.f.} OBJECT oButton ;
  SIZE 8,1.5

DCREAD GUI ;
   TITLE 'My Test Dialog' ;
   PARENT @oDialog ;
   FIT ;
   EXIT ;
   MODAL

oDialog:show()

COPY TO junk WHILE _Progress( oProgress, @lOk )

oButton:SetCaption('&Ok')
DC_AppEvent( @lOk )

IF !lOk
  FErase('JUNK.DBF')
ENDIF

oDialog:Destroy()
CLOSE ALL

RETURN nil

/* ----------------- */

STATIC FUNCTION _Progress ( oProgress, lOk )

LOCAL nMaxCount := RecCount()

DC_GetProgress( oProgress, RecNo() )
DC_AppEvent( @lOk, 0, .01 )

RETURN lOk
*** END OF EXAMPLE ***     
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How do I stop after the progress bar demonstration?

#3 Post by Eugene Lutsenko »

Hi, Roger!

I'm very glad to hear from you! You always help. Everything worked out. Thank you. Health and well-being to you and your loved ones!

P.s. I used this example of yours as a basis. But it worked when I added another line ( //<<<<<< Add This).

Code: Select all

      oSay97:SetCaption(L("РАСЧЕТ МАТРИЦ СХОДСТВА, КЛАСТЕРОВ И КОНСТРУКТОВ КЛАССОВ ЗАВЕРШЕН УСПЕШНО !!!"))
   oSay97:SetCaption(oSay97:Caption)

   oButton:activate := {||PostAppEvent(xbeP_Close,,,oDialog)}  //<<<<<< Add This
   oButton:SetCaption('&Ok')     // Деструктурирование окна отображения графического Progress-bar
   DC_AppEvent( @lOk )
   oDialog:Destroy()

Post Reply