Re: [WIN] Who wants a tough question?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Levi,

I just read an earlier post from Derek, and what he said there suggests that
I should mention that I don't know if the Win32Lib hack I suggested might
interfere with proper action of *other* control's styles or not.  And he
gives some suggestions which relate to what you want, though I still would
rather just be able to include the user specified styles simply & directly
in the windows create statement and have them *replace* the defaults.


Derek said:
Hi Brian,
I've been away on business, so sorry for the slow response.

>
> Question: Does 'create' still process flags?

Yes it does. In fact it works the same for all control types now. The
previous versions treated create() flags one way for Window controls and
another for other types. For Window, it used to replace the default flags
with any you might have specified, for others, it combined supplied flags
with the defaults. Now, Window works like the other controls.

> This works on version .50:
>
> constant
>   NoSizeWin = or_all( {WS_DLGFRAME,
>                        WS_SYSMENU,
>                        WS_MINIMIZEBOX} )
>
> constant
>   Win = create( Window, "Win", 0, 0, 0, 640, 480, NoSizeWin )
>
> -- Win is a Window that cannot be resized
>
> This no longer works in the latest release.  I don't have time to track it
> down because there have been so many changes lately...
>

To allow people complete flexibility when dealing with more complex flag
combinations, a new function, classDefaults() was set up. This function
allows you to set the default flags for a given control type. This can set
both the normal style flags and the extended style flags.

Given your example above, there are two basic ways to achieve what you want
to do.

1) --------------------
  sequence oldFlags
  atom NoSizeWin

  NoSizeWin = or_all( {WS_DLGFRAME,
                          WS_SYSMENU,
                          WS_MINIMIZEBOX} )
  -- Set default flags for Window to NoSizeWin
  oldflags = classDefaults(Window, {{CCflags, NoSizeWin} })

  -- Create a window using the (new) defaults
  Win = create( Window, "Win", 0, 0, 0, 640, 48, 0)

2) -------------------
  sequence oldFlags
  atom NoSizeWin

  NoSizeWin = or_all( {WS_DLGFRAME,
                          WS_SYSMENU,
                          WS_MINIMIZEBOX} )
  -- Set defaults for Window to zero (no flags at all)
  oldflags = classDefaults(Window, {{CCflags, 0}} )

  -- Create a window combining defaults (zero) with NoSizeWin
  Win = create( Window, "Win", 0, 0, 0, 640, 480, NoSizeWin)


To make this commonly used functionality easier to use, I'm packaging some
of the more useful Window flag combinations into reserved Win32Lib words.

David Cuny wants me to use these new words as Control Types but I would
rather them being used as Style Flags. So I'm very tempted to do both,
unless persuaded otherwise.

David's method:
   Win = create(NoSizeWindow, "Win", 0, 0, 0, 640, 480, 0)

Derek's method:
   Win = create(Window, "Win", 0, 0, 0, 640, 480, w32NoSizeWin)

My reasoning is that the first create() parameter describes a basic
behaviour, whereas the flags parameter describes a basic interface. Also,
having a "new" control type is adds more complexity in the library that I
don't think is justified for things that are essentially the same. For
example, there are many places in the library that does this sort of thing
...

  if window_type[id] = Window then ....

this might have to be changed to ...

  if find(window_type[id], {Window, NoSizeWindow, ...}) != 0 then ....

or maybe ...

  if and_bits(classAttr[window_type[id]], w32IsWindow) != 0 then ...


however, if we use these new words as predefined Window styles, the current
code is unchanged except in the create() function, with something like ...

   if equal(styleflag, w32NoSizeWin) then
       flags = or_bits(....)
   elsif ...
   else
       flags = or_bits(defaultflags, styleflags)
   end if

What does anybody else think?

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)


----- Original Message -----
From: "LEVIATHAN" <leviathan at USWEST.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, November 18, 2000 7:06 PM
Subject: Re: [WIN] Who wants a tough question?


> Heya Dan :)
>
> > Levi,
> >
> > 1.  Using which *version* of Win32Lib?
>
> *searches docs* I believe its .54 Bleeding Edge i've got :)
>
> > 2.  With WS_DLGFRAME in *addition* to any default, or *all by itself*,
> > or in replacement for default and with others?
>
> I'd have to assume WS_DLGFRAME in addition to another default
> (to get it to show up on the taskbar... for example, WS_DLGFRAME
> and WS_CAPTION don't work together to make a WS_DLGFRAME
> with the ability to show up on the taskbar, it looks like it makes a
> standard WS_OVERLAPPEDWINDOW)...
>
> I noted that all the window styles are hex... I assume there'd be
> some way to combine these hex numbers together to come up with
> my own window style (Such as getting a WS_DLGFRAME and
> getting the window to show up on the taskbar)... is there an article
> on MSDN on how to do this? if so, whats the URL?
>
> TIA,
>
> --"LEVIATHAN"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu