Page 1 of 1

StringGadget updating dependant on WaitWindowEvent()

Posted: Fri Jul 16, 2004 5:48 pm
by halo
I have a problem.

I am writing a DLL that controls a properties window for the main application. When the properties window is open, the user can still click and select things in the main window.

The problem is that string gadget text only gets updated if you use a WaitWindowEvent() command. However, if you use this command, it will freeze the program when you are trying to click on things in the main window. There doesn't seem to be any event for when you change the focus, so even though the properties window is not the active window, it still hangs until another event occurs.

The logical thing to do would be to use a WindowEvent() loop instead of WaitWindowEvent(). However, the string gadgets are totally unresponsive under these conditions.

Re: StringGadget updating dependant on WaitWindowEvent()

Posted: Fri Jul 16, 2004 6:37 pm
by PB
> The logical thing to do would be to use a WindowEvent() loop instead of
> WaitWindowEvent(). However, the string gadgets are totally unresponsive
> under these conditions.

Without seeing your code, this may be due to the CPU being 100% used
during the WindowEvent() loop. Try sticking Delay(1) in the loop like so:

Code: Select all

ev=WindowEvent() : if ev=0 : Delay(1) : EndIf ; Release CPU when app is idle.

Posted: Fri Jul 16, 2004 8:55 pm
by halo
I fixed this by using a callback function. If the window gets a close event, a global variable is set. I then have a function that returns true if the window has been closed. You can just call the "Has the window been closed" function at any time, instead of trying to intercept the event.

Posted: Sat Jul 17, 2004 6:10 am
by PB
Okay, I misunderstood what the problem was. :)