Re: win32lib: manipulating vWinMainState
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 02, 2004
- 488 views
Alexander Toresson wrote: > > Derek Parnell wrote: > > I will not be making vWinMainState global. However, I am interested > > in making things better/useful so what is the problem you were trying > > to solve by making this global? Maybe I can do it another way. > > The problem is that the include file should have and control a window, > without interrupting the main program. Using the openWindow() procedure > works perfect when WinMain() has been called, though the .ew's window is > "immune" to events if not. The problem is that vWinMainState is set to > kNotStarted. > A solution would be to set vWinMainState to kStarted in openWindow(), > but maybe that would interfere with the main program if it calls > WinMain()? > I don't understand the problem. Here is a couple of files that show what I think you are trying to do, and they work fine here, so I guess I don't really understand what you are trying to acheive. <---File: trace.ew---> constant TraceWin = create(Window, "Tracer", 0, 0, 0, 300, 300,0) openWindow(TraceWin, Normal) procedure traceEvent(integer self, integer event, sequence parms) if event = w32HMouse then setText(self, sprintf("Mouse %d", parms[1])) elsif event = w32HPaint then setText(self, sprintf("paint %d %d %d %d ", parms)) end if end procedure setHandler(TraceWin, {w32HPaint, w32HMouse}, routine_id("traceEvent")) <---end of file---> <---File: test.exw---> without warning include win32lib.ew include trace.ew constant PrimeWindow = create(Window, "Prime Window", 0, 200,100, 400, 400, 0) WinMain(PrimeWindow, Normal) <---end of file---> When I run the test program, the trace window opens and receives events. -- Derek Parnell Melbourne, Australia