Closed tajmone closed 3 years ago
NOTE — I'm not sure whether it's better to just declare progressCallback
as Global or define it in main code and have end users resort to Shared
in any procedure which needs to call it.
The point is that in PM NG there's no longer a progress bar showing the percentage, so it's usually enough to just call it once (passing 1) at the beginning of a file processing task, and once more at the end (passing 100).
The argument in favor of keeping it global would be for backward compatibility with older PM versions — in that case, end user would need to call it at different steps, using percentage values.
It ultimately boils down to whether authors using this template are planning to use this callback in the old fashion or just at the start and end points of a processing task (or maybe not even that).
I'll have to think about it, and the pros and cons of each approach.
For a practical and working implementation, see:
https://github.com/tajmone/pmotion2svg/blob/1.1.0/src/pm-interfaces.pbi#L57
Prototype ProtoProgressCallback( progress.l )
Global progressCallback.ProtoProgressCallback
ProcedureDLL setProgressCallback( *progressCallback )
progressCallback = *progressCallback
EndProcedure
In the PureBasic File I/O plug-in template
progressCallback()
needs to be defined in the main body, and thenShared
insidesetProgressCallback()
(either that or just define it asGlobal),
otherwise it won't be available to other procedures.Also, the following line need to be fixed:
it should be
= *progressCallback
!