Page 1 of 1
How do I stop after the progress bar demonstration?
Posted: Fri Feb 04, 2022 8:11 am
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()
Re: How do I stop after the progress bar demonstration?
Posted: Fri Feb 04, 2022 3:44 pm
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 ***
Re: How do I stop after the progress bar demonstration?
Posted: Fri Feb 04, 2022 9:02 pm
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()