Dark side of Events !!!!

Just starting out? Need help? Post your questions and find answers here.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Dark side of Events !!!!

Post by Skipsy »

hello,
I am afraid I misunderstood something concerning windows and events.

I have a main window and sometimes I have to open a new small window
(let say a child window) above the main one.

In the main window I check for a 'repaint event' like this :

Code: Select all

EVT_WIND.l = WindowEvent()

Delay (1)

If EVT_WIND > 0
  Case #PB_EventRepaint
    beep_(100,50)
Repaint event is detected (beep) if I move a system window
above my window but not if I move my child window".

In the Child window I have :

Code: Select all

EVT_WIND.l = WaitWindowEvent()
Delay (1)
Do you see where I am wrong ???
Thks
Beware of the man who has the solution before he understands the problem...
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: Dark side of Events !!!!

Post by GPI »

look in the help for EventWindowId()! You need only one WindowEvent() (and when you don't don't make things while waiting for a event, use WaitWindowEvent() or you burst your Process to 100% CPU) and the find with EventWindowID() out, which window has get this message.

GPI
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Wel... I understand my mystake (only 1 event loop) but it worst than
I thought.

Even the following does not work : If I move a message request over
my window, NO repaint event is detected :!: :!:

Code: Select all

  EVT_WIND.l = WindowEvent()
  Delay (1)

  If EVT_WIND > 0
      Select EVT_WIND

         Case #PB_EventRepaint
             beep_(100,30)

         Case #PB_Event_Menu 
             select  EventMenuID()

                 Case #Help				
                     MessageRequester("Test", "test, 0)

              endselect
       endselect
          
Do I need an exorcist :?: :lol:
Beware of the man who has the solution before he understands the problem...
Post Reply