Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!pa.dec.com!wsl.dec.com!klee From: klee@wsl.dec.com (Ken Lee) Newsgroups: comp.windows.x Subject: Re: Help! What is the magic of the sleep() statement? Message-ID: <1991Jan9.153215@wsl.dec.com> Date: 9 Jan 91 23:32:15 GMT References: <1991Jan9.150326.6248@warwick.ac.uk> Sender: news@pa.dec.com (News) Reply-To: klee@wsl.dec.com Organization: DEC Western Software Laboratory Lines: 16 In article <1991Jan9.150326.6248@warwick.ac.uk>, csuyk@warwick.ac.uk (FUNG Wai Wa) writes: |> The following few statements attempt to create a window and draw a line |> with some strings. I found that the sleep(1) statement is very crucial |> for its success. This is one of the most common X beginners problems. X is asynchronous, so there is no guarantee that your window is mapped before you start drawing. Instead, you should only draw on a window after receiving an expose event. Most people use the X Toolkit, which worries about this for you. -- Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@wsl.dec.com uucp: uunet!decwrl!klee