Re: Win32Libv50: How make window invisible (initially?)?
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Sep 27, 2000
- 517 views
Matt, Thanks; *very* interesting! Brought quite a few questions to mind :) However, I pretty much solved my problem by taking Wolf's advice and first finding screen center, & then centering the modal window when I *create* it; too too obvious! The thought had dimly occurred to me, but I hadn't implemented it till after Wolf suggested it. But it had never occurred to me to center a window (by moving it) *before* even opening it, as Wolf also suggested and you utilized in your code sample below. I think that by itself should be sufficient to keep any "initial" display from *flickering* over to a new centered position, as was happening when I opened a window first and then centered it. And it turns out I already had downloaded winconst.ew sometime previously, but I couldn't make sense of it then, nor now. I can guess that HWND might mean "handle of the window", but can't guess offhand what difference there might be between "top" and "topmost"; similarly, I can guess that SWP_xxx in some way refers to the function "SetWindowPosition", but that's only because you *used* some of the constants that start with "SWP" in "SetWindowPosition", which makes it jump out at me. But how would one know what all those *other* constants in winconst.ew *refer* to, or where they are used, anyway? And where does "SetWindowPosition" *come from*? I can vaguely understand that you are calling some c-function somewhere, but where? And probably most important, how do you know what goes where when you do "c_func(..."? If winconst.ew contained some comments that helped answer those questions, then I (and/or others) could at least make a little sense of it. Like if those constants are intended to be used in specific functions relating to the first letters in the constants name, then a comment at the start of a group of them telling what function they are to be used in would be helpful. Plus of course a listing of what parameters go where *in* the function. Oh, and when you do "SWP_HIDEWINDOW + SWP_NOACTIVATE" in "xSetWindowPos", is that functionally equivalent to the "or_all" used to combine flags in Win32Lib? Dan inquiring minds want to know, unless of course they have to RTFM :) P.S. these were just questions that occurred to me in reading your post; no real urgency in answering them :) ----- Original Message ----- From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, September 26, 2000 11:07 AM Subject: Re: Win32Libv50: How make window invisible (initially?)? + Win32Lib dev request > > From: Dan B Moyer > > > > > > Maybe there is some set of "styles" which when or'd will give the > > fundamental properties of a modal window, but *not* include > > "WS_VISIBLE" > > that would work with "openWindow"? > > > > You might try using SetWindowPos: > > -- Tested code > -- You can find these constants and many more in winconst.ew in the > archives: > constant > HWND_BOTTOM = 1, > HWND_NOTOPMOST = (-2), > HWND_TOP = 0, > HWND_TOPMOST = (-1), > > SWP_DRAWFRAME = 32, > SWP_FRAMECHANGED = 32, > SWP_HIDEWINDOW = 128, > SWP_NOACTIVATE = 16, > SWP_NOCOPYBITS = 256, > SWP_NOMOVE = 2, > SWP_NOSIZE = 1, > SWP_NOREDRAW = 8, > SWP_NOZORDER = 4, > SWP_SHOWWINDOW = 64, > SWP_NOOWNERZORDER = 512, > SWP_NOREPOSITION = 512, > SWP_NOSENDCHANGING = 1024 > > -- replace your call to moveWindow with this: > integer ok > ok = c_func( xSetWindowPos, { getHandle( aModalWindow ), HWND_TOP, posx, > posy, xsize, ysize, SWP_HIDEWINDOW + SWP_NOACTIVATE) > > Then, you can change OnClick_Tut1Button() to: > > procedure OnClick_Tut1Button() > center_win(aModalWindow) -- center it > openWindow( aModalWindow, Modal ) > end procedure > > > -- End Code > > Now you're flicker free. > > Matt