PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD22] How to display an animation when running a long process.
[WD22] How to display an animation when running a long process.
Iniciado por guest, 03,feb. 2018 00:31 - 1 respuesta
Publicado el 03,febrero 2018 - 00:31
If I have a query that takes some time I want to show a loading window with an animated image. In the past I've done it with gifs similar to how DW describes in the post below.

http://27130.foren.mysnip.de/read.php…

The problem is that this way causes the windows taskbar to display above our fullscreen app when the thread runs. Also, it causes random crashes from time to time. Probably because "A secondary thread cannot directly open a window with the standard WLanguage functions such as: Open, Use, ..." (Source) Using ExecuteMainThread() doesn't work either. The animation is still blocked by whatever WinDev code/query is running.
Publicado el 03,febrero 2018 - 00:54
Hi Curtis,

I do like this and its work for some of function.

But when i apply to another process with the same code, it is not work (hang).

Maybe you can test it.

// BUTTON REPORT
IF WinStatus(WIN_Progress_PleaseWait)=NotFound THEN
OpenChild(WIN_Progress_PleaseWait)
WIN_REPORT.lp_ItemGroupSales1() // Local Procedure
ELSE
ToastDisplay("Report under process",toastLong,vaMiddle,haCenter,iLightRed)
END


HourGlass()

//lp_SalesByItemGroup1
ThreadExecute("Thread A",threadNormal,lp_SalesByItemGroup1)
ThreadWaitSignal()

HourGlass(False)


PROCEDURE lp_SalesByItemGroup1()

ThreadSendSignal(“.”)

// Your Query Process Here


// Next
nSubscript is int
sThreadName is string
nNbThreads is int
nNbThreads = gnThreadNum

// Stop all the existing threads
FOR nSubscript = 1 TO nNbThreads
sThreadName = csThreadNameA+nSubscript
// Check whether the thread exists
IF ThreadState(sThreadName)<>threadUnknown THEN
// Attempt to stop the thread
IF ThreadStop(sThreadName,200)=False THEN
// Check whether it still exists
IF ThreadState(sThreadName)<>threadUnknown THEN
Error(StringBuild("Unable to stop thread #: %1",nSubscript))
END
END
END
END

iConfigure(gS_PPReceipt_PrinterReport)
iWindowCancel(False)
iPreview(i100)
iPrintReport(RPT_SalesReportItemGroup)

Close(WIN_Progress_PleaseWait)

Regards,
Mujahid