Hi everybody,
HEEELLLLPPPP!!!!! (sorry, getting desperate)

I'm probably overlooking something fundamental over here, but after 2 days of trying to get this to work, I thought I'd better ask before spending more time on this.

I'm trying to do the following. Make a trayitem for the application and hide the main window, then show a balloontip for a set amount of time after a certain action in the application is finished (the application then needs the user's attention). The idea basically is to show a balloontip from a class which is called from the main window. The class shows the balloontip, starts the thread, which sleeps for a set amount of time (passed as a parameter), and then tells the class that it needs to make the balloontip disappear again. So all actions that are needed to show the balloontip are running within the class, and only one call from the application is needed (ShowBalloonTip) to show the balloontip, wait, and hide it again.

No matter which way I try this, the thread never passes control back to the application (till I click on the little icon on the taskbar). I tried to make a simple test for this and found that if the userinterface of the calling window is updated from the thread, the thread passes control back to the application. When I try to call the main window through an interface though, then control doesn't pass back.

In short, this is what I have done as a simple test.
(you can *download my example project* at http://www.useitgroup.net/sleeptest.rbp)
Interface :
   MsgReceiver
   Sub ReceiveMessage(bDone As Boolean)

Thread:
   Make a class MyThread with Super Thread
   Add a property iTimeOutInms As Integer
   Add a property mReceiver As MsgReceiver
In the Constructor Method (Sub Constructor(msg As MsgReceiver, iTimeout As Integer)
      mReceiver=msg
      iTimeoutInms=iTimeout*1000
   In the Run Event Handler
      self.sleep iTimeOutInms, False
      'Window1.EditField1.Text="done"
      Call mReceiver.ReceiveMessage(True)

Main Window :
   Set the interface to MsgReceiver
   Add a property :
       mThread as MyThread
   In the ReceiveMessage Method :
       MsgBox "sleep done"
   In the Open Event Handler
       mThread=new MyThread(self,1) // sleep 1 second
       mThread.Run


What puzzles me is that when I run this in the Debugger, it works fine, but when I build it and then run the application, the msgbox doesn't show till I move the mouse over the Window. So it looks like the Thread never calls the ReceiveMessage method in the main window. When I add an Editfield1 to the main window, and put Window1.EditField1.Text="done" in the Run Event handler of the Thread, then the thread does pass control back to the main window. The problem is that I can't use this way, since my main window will be hidden after I make the trayitem, so updating editfield1 also does not pass control back to the application. I also tried the trayapp plugin (http://www.control-d.co.uk/download.htm), but that one did not show the ballloon notification on Windows 2000 (although it did work on Windows XP) and the ToastWindow plugin (same website), but that one just like my code does not show any balloontips if the window is hidden.

Anyways, I've been stuck with this for about 2 days, and hope someone smarter than me might be able to help.
If anyone could help here, it would be appreciated.

Thanks in advance,
Dirk Cleenwerck
Chief programmer
Useitgroup NV


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to