1. [WIN] drop-down lists stay in same place when window moved

In my "Templates Handler", any drop-down list that is "open" (dropped down)
neglects to move with the window if it's moved or resized.  Can anyone tell
me how to make an open dropped down list move with the window?

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: [WIN] drop-down lists stay in same place when window moved

Dan Moyer wrote:

> In my "Templates Handler", any drop-down list that
> is "open" (dropped down) neglects to move with the
> window if it's moved or resized.  Can anyone tell
> me how to make an open dropped down list move with
> the window?

This was a bug for a long time in Win32Lib. I finally got around to fixing
it, but I don't see it in the latest release of Win32Lib. Perhaps I never
released the code, or something. I can't vouch that it will work in the
current version of Win32Lib - there have been so many changes, I don't
really know the all the ins and outs of the code anymore.

First, I created a variable to hold the ID of the currently open dropdown,
if any:

   -- constants
   constant
       WM_WINDOWPOSCHANGING    = 70,
       CB_SHOWDROPDOWN         = 335

   integer
       theDropList
       theDropList = 0

(You can tell the code is old, since the two constants weren't defined!)

When a combo is opened (CBN_DROPDOWN), set openComboId to the open combo.
When the combo closes (CBN_CLOSEUP), set openComboId to zero. This code
lived in WndProc:

     -- dropdown opened?
     elsif event = CBN_DROPDOWN then
         -- save droplist id
         theDropList = myControl

      -- dropdown closed?
     elsif iMsg = CBN_CLOSEUP then
         -- clear droplist
         theDropList = 0

     end if

On a window resize/moving event, check if openComboId is nonzero. If it is,
a close combobox event (CB_SHOWDROPDOWN, I think) was sent to the open
combo, and the flag was cleared. This also lived in WndProc. I think that
WM_WINDOWPOSCHANGING 'magically' handles both of those events:

    -- handle dropdown
    elsif iMsg = WM_WINDOWPOSCHANGING then
        if theDropList then
            -- close the list
            result = sendMessage( theDropList, CB_SHOWDROPDOWN, 0, 0 )
            -- clear the droplist
            theDropList = 0
        end if

I hope this helps. The list 'hanging' there is certainly a *weird* behavior!

-- David Cuny

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

3. Re: [WIN] drop-down lists stay in same place when window moved

Thanks David,
I was sure that I'd included this fix already, but I guess I missed it out.

----- Original Message -----
From: "David Cuny" <dcuny at LANSET.COM>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [WIN] drop-down lists stay in same place when window moved


>
> Dan Moyer wrote:
>
> > In my "Templates Handler", any drop-down list that
> > is "open" (dropped down) neglects to move with the
> > window if it's moved or resized.  Can anyone tell
> > me how to make an open dropped down list move with
> > the window?
>
> This was a bug for a long time in Win32Lib. I finally got around to fixing
> it, but I don't see it in the latest release of Win32Lib. Perhaps I never
> released the code, or something. I can't vouch that it will work in the
> current version of Win32Lib - there have been so many changes, I don't
> really know the all the ins and outs of the code anymore.
>
> First, I created a variable to hold the ID of the currently open dropdown,
> if any:
>
>    -- constants
>    constant
>        WM_WINDOWPOSCHANGING    = 70,
>        CB_SHOWDROPDOWN         = 335
>
>    integer
>        theDropList
>        theDropList = 0
>
> (You can tell the code is old, since the two constants weren't defined!)
>
> When a combo is opened (CBN_DROPDOWN), set openComboId to the open combo.
> When the combo closes (CBN_CLOSEUP), set openComboId to zero. This code
> lived in WndProc:
>
>      -- dropdown opened?
>      elsif event = CBN_DROPDOWN then
>          -- save droplist id
>          theDropList = myControl
>
>       -- dropdown closed?
>      elsif iMsg = CBN_CLOSEUP then
>          -- clear droplist
>          theDropList = 0
>
>      end if
>
> On a window resize/moving event, check if openComboId is nonzero. If it
is,
> a close combobox event (CB_SHOWDROPDOWN, I think) was sent to the open
> combo, and the flag was cleared. This also lived in WndProc. I think that
> WM_WINDOWPOSCHANGING 'magically' handles both of those events:
>
>     -- handle dropdown
>     elsif iMsg = WM_WINDOWPOSCHANGING then
>         if theDropList then
>             -- close the list
>             result = sendMessage( theDropList, CB_SHOWDROPDOWN, 0, 0 )
>             -- clear the droplist
>             theDropList = 0
>         end if
>
> I hope this helps. The list 'hanging' there is certainly a *weird*
behavior!
>
> -- David Cuny
>
>
>

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

4. Re: [WIN] drop-down lists stay in same place when window moved

David,

Thanks, I'll see if I can do anything with your suggestion. Yeah, "glued" in
place isn't what anyone would tend to expect!

Dan


----- Original Message -----
From: "David Cuny" <dcuny at LANSET.COM>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [WIN] drop-down lists stay in same place when window moved


>
> Dan Moyer wrote:
>
> > In my "Templates Handler", any drop-down list that
> > is "open" (dropped down) neglects to move with the
> > window if it's moved or resized.  Can anyone tell
> > me how to make an open dropped down list move with
> > the window?
>
> This was a bug for a long time in Win32Lib. I finally got around to fixing
> it, but I don't see it in the latest release of Win32Lib. Perhaps I never
> released the code, or something. I can't vouch that it will work in the
> current version of Win32Lib - there have been so many changes, I don't
> really know the all the ins and outs of the code anymore.
>
> First, I created a variable to hold the ID of the currently open dropdown,
> if any:
>
>    -- constants
>    constant
>        WM_WINDOWPOSCHANGING    = 70,
>        CB_SHOWDROPDOWN         = 335
>
>    integer
>        theDropList
>        theDropList = 0
>
> (You can tell the code is old, since the two constants weren't defined!)
>
> When a combo is opened (CBN_DROPDOWN), set openComboId to the open combo.
> When the combo closes (CBN_CLOSEUP), set openComboId to zero. This code
> lived in WndProc:
>
>      -- dropdown opened?
>      elsif event = CBN_DROPDOWN then
>          -- save droplist id
>          theDropList = myControl
>
>       -- dropdown closed?
>      elsif iMsg = CBN_CLOSEUP then
>          -- clear droplist
>          theDropList = 0
>
>      end if
>
> On a window resize/moving event, check if openComboId is nonzero. If it
is,
> a close combobox event (CB_SHOWDROPDOWN, I think) was sent to the open
> combo, and the flag was cleared. This also lived in WndProc. I think that
> WM_WINDOWPOSCHANGING 'magically' handles both of those events:
>
>     -- handle dropdown
>     elsif iMsg = WM_WINDOWPOSCHANGING then
>         if theDropList then
>             -- close the list
>             result = sendMessage( theDropList, CB_SHOWDROPDOWN, 0, 0 )
>             -- clear the droplist
>             theDropList = 0
>         end if
>
> I hope this helps. The list 'hanging' there is certainly a *weird*
behavior!
>
> -- David Cuny
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu