1. Win32Libv50: How make window invisible (initially?)?

I'm having trouble making a window invisible.  I'm using Wolf's "center"
routine for a modal window, but the window "flickers" as it is first opened
and then moved; not a big deal, but I'd rather it didn't.

I tried putting setVisible false *before* I opened the modal window, & it
had no effect; then I put it *after* open but before center & then
setVisible true after center, & it still flickered from where it started to
where it was moved (if I neglect to setVisible true, it ends up truly
invisible, but apparently too late to stop the flicker).

I thought maybe there is some way to specify the window to be invisible
initially in the "create", but couldn't see how.

Dan

new topic     » topic index » view message » categorize

2. Re: Win32Libv50: How make window invisible (initially?)?

Hi Dan,
unfortunately, Win32Lib always assumes that modal windows are visible. I can
achieve what you want for a non-modal window

----------------------------
object VOID

  openWindow(myWin, #08000000)  --a kludge to open it "hidden"

  VOID = c_func( xShowWindow, { getHandle(myWin), SW_SHOWNORMAL } ) -- to
view it.

  VOID = c_func( xShowWindow, { getHandle(myWin), SW_HIDE } ) -- to hide it
again.

-- This only works in 0.53 because getHandle is global from that version.

----------------------------

A number of changes will have to occur to allow initially hidden modal
windows. The main one being that modal windows, by definition always have
focus; but if its hidden, it shouldn't have focus.

Currently, Win32lib always makes sure that the latest open modal window
always has effective focus. It wouldn't be very friendly to have a hidden
window that has the focus!

I think this is so, but maybe David or Matt can confirm or deny.
----
cheers
Derek.

----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, September 26, 2000 4:09 PM
Subject: Win32Libv50: How make window invisible (initially?)?


> I'm having trouble making a window invisible.  I'm using Wolf's "center"
> routine for a modal window, but the window "flickers" as it is first
opened
> and then moved; not a big deal, but I'd rather it didn't.
>
> I tried putting setVisible false *before* I opened the modal window, & it
> had no effect; then I put it *after* open but before center & then
> setVisible true after center, & it still flickered from where it started
to
> where it was moved (if I neglect to setVisible true, it ends up truly
> invisible, but apparently too late to stop the flicker).
>
> I thought maybe there is some way to specify the window to be invisible
> initially in the "create", but couldn't see how.
>
> Dan

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Libv50: How make window invisible (initially?)?

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Libv50: How make window invisible (initially?)?

On Wed, 27 Sep 2000 01:10:04 -0700, Dan B Moyer asked:

>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(..."?

Dan,

The constants in winconst.ew are windows constants which are needed to use
the functions in the dynamic link libraries (DLL's) of the windows API.  To
find out what goes where and what constants are used for what, just search
http://msdn.microsoft.com/

For example, SetWindowPosition is actually called 'SetWindowPos'.  All
you'd want to know about this function can be found at

When you search for something at MSDN, you'll usually want to pick the link
that has "library/psdk/" in it.  psdk stands for Platform Software
Development Kit.  At the bottom of the page, it says "Library: Use
User32.lib" which means that this function is in 'user32.dll'.  You will
see what the parameters are and what constants it uses.  But it only gives
the names of the constants, not the values.  The values are in the header
files (in this case, they are "Declared in Winuser.h").  Now you could
either download the Platform SDK and fish those constants out of winuser.h
or take advantage of the work already done in winconst.ew, which is simply
the majority of Windows constants ripped out of different header files and
compiled into one Euphoria library.

But the best way to learn how to use DLL routines in your program is to
study win32lib itself.  Basically, it can be a real pain in the butt
working with the Windows API using Euphoria.  The hardest part is getting
your C structures correct, but Win32Lib has some lower-level routines that
make it a bit less hellish.  And, once again, the best way to learn how
it's done is to study the blood and guts of Win32Lib.

On the other hand, if you just want to write Windows programs, then you'll
soon appreciate how wonderful a library Win32Lib is.  (thanks again David,
et al)

-- Brian

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32Libv50: How make window invisible (initially?)?

Wolf kindly (with a big grin!) suggested that I simply find the center of
the screen *before* I create my modal window, and center it when I create
it; that way, no possible flicker, and no need to try to make it invisible
to fix something that's not happening.  sigh.

Dan

----- Original Message -----
From: "Dan B Moyer" <DANMOYER at prodigy.net>
To: "Euphoria Mail List" <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, September 25, 2000 10:09 PM
Subject: Win32Libv50: How make window invisible (initially?)?


> I'm having trouble making a window invisible.  I'm using Wolf's "center"
> routine for a modal window, but the window "flickers" as it is first
opened
> and then moved; not a big deal, but I'd rather it didn't.
>
> I tried putting setVisible false *before* I opened the modal window, & it
> had no effect; then I put it *after* open but before center & then
> setVisible true after center, & it still flickered from where it started
to
> where it was moved (if I neglect to setVisible true, it ends up truly
> invisible, but apparently too late to stop the flicker).
>
> I thought maybe there is some way to specify the window to be invisible
> initially in the "create", but couldn't see how.
>
> Dan
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: Win32Libv50: How make window invisible (initially?)?

> From: Brian Broker

Wolf's solution was simply too obvious for most of us to think of. :(  We
got all wrapped up in the API, and forgot about simple programming
techniques.  But this brings something else to mind.

Has anyone created a little library (it shouldn't be too hard, I think) to
automatically size/position controls based on the display settings.  That
seems to be a big missing point in win32lib, and maybe it shouldn't be a
part of the main lib, but it would make app's look much nicer when other
people run them on different machines.  I've thought about doing something
like this, but I guess I haven't gotten up enough energy to do anything
about it.
<snip>

> To
> find out what goes where and what constants are used for
> what, just search
> http://msdn.microsoft.com/
>
> For example, SetWindowPosition is actually called 'SetWindowPos'.  All
> you'd want to know about this function can be found at
> http://msdn.microsoft.com/library/psdk/winui/windows_2blf.htm
>

You can also check out the Win32.hlp file that's in the archives.  I believe
this was originally a Borland file.  It's pretty old, and some of the
information has been superceded, but it's still good for most stuff--and
often quicker than pulling up MS's web page.

<snip>

> But the best way to learn how to use DLL routines in your
> program is to
> study win32lib itself.  Basically, it can be a real pain in the butt
> working with the Windows API using Euphoria.  The hardest
> part is getting
> your C structures correct, but Win32Lib has some lower-level
> routines that
> make it a bit less hellish.  And, once again, the best way to
> learn how
> it's done is to study the blood and guts of Win32Lib.

C structures can be a real pain to work with in Eu, but they don't have to
be.  David came up with a pretty elegant solution IMHO, and Derek and
other's (like me) have come up with some enhancements.  My 'contribution'
was using functions to populate the structures.  That way, you only write
the 'store( struct, member, value)' code once (and if you look at my
structure declarations, the names get pretty long).  One thing to remember
when debugging your code:  if it's not working, and you can't see any reason
why, check the structure size and member values/types.  Many structures used
in the Win32 API need the size to be exact, and for you to store the size of
the structure in the first element (mainly for versioning control).

new topic     » goto parent     » topic index » view message » categorize

7. Re: Win32Libv50: How make window invisible (initially?)?

On Wed, 27 Sep 2000 09:44:47 -0700, Matthew Lewis wrote:

>> From: Brian Broker
>
>Wolf's solution was simply too obvious for most of us to think of. :(  We
>got all wrapped up in the API, and forgot about simple programming
>techniques.  But this brings something else to mind.
>
>Has anyone created a little library (it shouldn't be too hard, I think) to
>automatically size/position controls based on the display settings.  That
>seems to be a big missing point in win32lib, and maybe it shouldn't be a
>part of the main lib, but it would make app's look much nicer when other
>people run them on different machines.  I've thought about doing something
>like this, but I guess I haven't gotten up enough energy to do anything
>about it.

What kind of routines are you looking for?  I've created quite a few
already, like my centerwin.ew lib for centering a window in the desktop
workspace.  I plan on integrating those into Win32Lib (as I suggested in an
earlier post, e.g. getClientRect( Screen ) should return what my getWorkarea
() function returns) and submitting the changes to Derek.  Or are we
looking for an add-on lib?

-- Brian

new topic     » goto parent     » topic index » view message » categorize

8. Re: Win32Libv50: How make window invisible (initially?)?

----- Oorspronkelijk bericht -----
Van: Brian Broker <bkb at CNW.COM>
Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Verzonden: woensdag 27 september 2000 19:40
Onderwerp: Re: Win32Libv50: How make window invisible (initially?)?


> On Wed, 27 Sep 2000 09:44:47 -0700, Matthew Lewis wrote:
>
> >> From: Brian Broker
> >
> >Wolf's solution was simply too obvious for most of us to think of. :(  We
> >got all wrapped up in the API, and forgot about simple programming
> >techniques.  But this brings something else to mind.
> >
> >Has anyone created a little library (it shouldn't be too hard, I think)
to
> >automatically size/position controls based on the display settings.  That
> >seems to be a big missing point in win32lib, and maybe it shouldn't be a
> >part of the main lib, but it would make app's look much nicer when other
> >people run them on different machines.  I've thought about doing
something
> >like this, but I guess I haven't gotten up enough energy to do anything
> >about it.
>
> What kind of routines are you looking for?  I've created quite a few
> already, like my centerwin.ew lib for centering a window in the desktop
> workspace.  I plan on integrating those into Win32Lib (as I suggested in
an
> earlier post, e.g. getClientRect( Screen ) should return what my
getWorkarea
> () function returns) and submitting the changes to Derek.  Or are we
> looking for an add-on lib?
>
> -- Brian

I think Matt means routines for converting the properties according to
screen- and charactersizes. This was one of the first problems I encountered
when exchanging programs with Wolf for the tutor: he used a 640 x 480
screen, and I an 800 x 600.
Controls and sizes of characters look a lot different in different
resolutions, I can tell you.

-- Ad

new topic     » goto parent     » topic index » view message » categorize

9. Re: Win32Libv50: How make window invisible (initially?)?

Matthew Lewis wrote:

> Has anyone created a little library (it shouldn't
> be too hard, I think) to automatically size/position
> controls based on the display settings.

I'd written something like that for one of my DOS window managers, based on
the TCL/TK model. The logic for dividing up space between bounding boxes can
be more complex than you might think, but it is doable. It can be a bit
confusing to work with, but it's slick.

The basic hook to the system would be the onSize event - whenever a window
was resized, you would recursively go through each bounding box and
calculate the real estate that each widget gets. You would probably want to
wrap the create() event, so that instead of supplying the x/y/cx/cy values
of a control, you would give a different set of attributes.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

10. Re: Win32Libv50: How make window invisible (initially?)?

> From: Brian Broker
>
> What kind of routines are you looking for?  I've created quite a few
> already, like my centerwin.ew lib for centering a window in
> the desktop
> workspace.  I plan on integrating those into Win32Lib (as I
> suggested in an
> earlier post, e.g. getClientRect( Screen ) should return what
> my getWorkarea
> () function returns) and submitting the changes to Derek.  Or are we
> looking for an add-on lib?
>

I'm not really sure, but I suspect that what I have in mind would probably
be better off as an add-on.  I wasn't very clear, though.  What I'm really
after is a way to size and position all of the controls within a window,
resize the fonts, etc.  Then, rather than supplying absolute coordinates for
the x,y and the size parameters for create(), there would be a call to
getSystemMetrics() or something, and the parameters would be resolved by
function calls or something:

include win32lib.ew
include winsize.ew  -- here's the add-on lib

constant
Win = create(Window, "Test", 0, 0, 0, screenPctX( 50 ),screenPctY( 50), ),
MyLabel = create( RText, "MyLabel", Win, winPctX( Win, 5 ), winPctY( Win, 10
), winPctX(Win,10), winPctY(Win, 4), 0)
...
etc

The hardest part of this is figuring out what sort of API to use.  Once
that's done, it should be pretty easy to write the rest.  I just haven't
come up with something that seems like a good idea.

Matt

new topic     » goto parent     » topic index » view message » categorize

11. Re: Win32Libv50: How make window invisible (initially?)?

I was thinking of being able to specify sizes and coordinates in terms
relative to its owner. For example...

myEditBox = create(MleText, "", theWindow, 0.20, 0.1, .75, .5, 0)

Where the numbers < 1 represent percentages of the Window sizes. These could
then be mapped to real pixel sizes during a WM_RESIZE and WM_CREATE
messages.

----
cheers
Derek.

----- Original Message -----
From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, September 28, 2000 7:20 AM
Subject: Re: Win32Libv50: How make window invisible (initially?)?


> > From: Brian Broker
> >
> > What kind of routines are you looking for?  I've created quite a few
> > already, like my centerwin.ew lib for centering a window in
> > the desktop
> > workspace.  I plan on integrating those into Win32Lib (as I
> > suggested in an
> > earlier post, e.g. getClientRect( Screen ) should return what
> > my getWorkarea
> > () function returns) and submitting the changes to Derek.  Or are we
> > looking for an add-on lib?
> >
>
> I'm not really sure, but I suspect that what I have in mind would probably
> be better off as an add-on.  I wasn't very clear, though.  What I'm really
> after is a way to size and position all of the controls within a window,
> resize the fonts, etc.  Then, rather than supplying absolute coordinates
for
> the x,y and the size parameters for create(), there would be a call to
> getSystemMetrics() or something, and the parameters would be resolved by
> function calls or something:
>
> include win32lib.ew
> include winsize.ew  -- here's the add-on lib
>
> constant
> Win = create(Window, "Test", 0, 0, 0, screenPctX( 50 ),screenPctY( 50), ),
> MyLabel = create( RText, "MyLabel", Win, winPctX( Win, 5 ), winPctY( Win,
10
> ), winPctX(Win,10), winPctY(Win, 4), 0)
> ...
> etc
>
> The hardest part of this is figuring out what sort of API to use.  Once
> that's done, it should be pretty easy to write the rest.  I just haven't
> come up with something that seems like a good idea.
>
> Matt

new topic     » goto parent     » topic index » view message » categorize

12. Re: Win32Libv50: How make window invisible (initially?)?

David Cuny wrote:

> Matthew Lewis wrote:
>
> > Has anyone created a little library (it shouldn't
> > be too hard, I think) to automatically size/position
> > controls based on the display settings.
>
> I'd written something like that for one of my DOS window
> managers, based on
> the TCL/TK model.

Which DOS window manager (ie, where can I get it)?

> The logic for dividing up space between
> bounding boxes can
> be more complex than you might think, but it is doable. It
> can be a bit
> confusing to work with, but it's slick.

Sounds interesting.

> The basic hook to the system would be the onSize event -

Now you're getting fancy.  I was actually only talking about the
sizing/positioning at creation, but I suppose that once you've figured out
how to do it then, it becomes almost trivial to do it at an arbitrary event.

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu