PDA

View Full Version : Using DynaMonitor



skarloc
07-22-2012, 04:15 AM
Hi everyone,

I have a function that takes a fair amount of time to execute - as a result, I'd like a way of showing where it's got to and an abort button to allow the user to stop it (like generating a preview in Layout).

I gather the way to do this is to create a dynamic monitor, thusly:


dyna_monitor = lwsdk.DynaMonitorFuncs().create("Running my loop", "Takin' me time...")
if dyna_monitor:
dyna_monitor.init(dyna_monitor.data, numLoops)

And, when I go through an iteration:


if dyna_monitor:
result = dyna_monitor.step(dyna_monitor.data, 1)
if result:
break

However, no window is displayed and pressing escape does nothing. Is this what I need to do to have this kind of functionnality?

Thanks.

[EDIT : I've gone through the other development forums with no success - although I can't "speak" LWScript, I can understand it...]

Sensei
07-22-2012, 04:52 AM
Dynamic Monitor global in LWSDK is Modeler's only.
It's showed on left bottom of Modeler, on right side of "Sel: 0" (not another window).

Read LWSDK about it
LWSDK/html/globals/modmon.html

skarloc
07-22-2012, 05:13 AM
Ah, ok, thanks - I shaln't waste time trying to get it to work... Any ideas on how I could do what I'd like?

I've tried creating a panel which opens in non-modal form. Unfortunately, I can't get Layout to refresh.

When I program C+ Builder, if I have processor-intensive loops, adding Application->ProcessMessages() allows the program to receive messages and thus handle any aborts you may require. But I've not (yet?) seen that in LW...

Sensei
07-22-2012, 05:23 AM
Like I said DynaMonitor is exclusive for Modeler.
Layout have Layout Monitor global.
Search for Python equivalent of it
LWSDK/html/globals/laymon.html

skarloc
07-22-2012, 06:06 AM
Dzien Dobré again.

Thanks for your help - I don't know who had the bright idea to call the 2 functions that do very similar things completely different names (DynaMonitorFuncs and LWLMonFuncs) - no wonder my greps and internet searches didn't help much (searching for "Monitor" didn't help me find LWLMonFuncs for example). I've got it working, now, so it's all hunky-dory thanks to you.

Sensei
07-22-2012, 06:29 AM
Dzień dobry = Hello.. ;)

Dziekuję = thank you.

IIRC, they're differently implemented in the past, before get integrated with Layout/Modeler windows.

skarloc
07-22-2012, 07:28 AM
I actually said "hello" on purpose ("hello again"). I spent 3 months in Krakow about 10 years ago - I can only remember how to pronounce the words, not how to write them (and I never needed to write "hello") !

Do widzenia !

Sensei
07-22-2012, 07:49 AM
I see.. :)

Do you saw the Dragon? ;)

skarloc
07-22-2012, 08:25 AM
Yeah, but not with flaming mouth. It's quite a common symbol IIRC. I really liked the town square, escpecially at Christmas - and the trumpeter ! A real surprise when you first hear this. Can't afford an automated bell - hire a trumpeter !

Sensei
07-22-2012, 08:38 AM
The dragon was living in the cave behind him (it was top secret way to the Castle), and eating virgins ;)
that's why there is no virgins in Krakow.. :p

Trumpeter is "breaking" sound in some moment. It's remembering of fact that he was killed by Turkey army's arrow in the middle ages.. Trumpeter is in Krakow for 700+ years.

In New Year it's usually half million people on the Main Market.