Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Floating Window  (Read 1115 times)

0 Members and 1 Guest are viewing this topic.
Floating Window
« on: January 13, 2009, 02:48:03 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
I've got one window to float on the other by setting up it's owner, but my main problem has to do with the focus on each window like to pick an option on the toolbar you need to bring it into focus first and only then can you pick an option, so you're switching in between windows having to activate each one first before you can pick an option, what I want to do is to avoid that from happening, so like clicking an option on a non-activated is the same as clicking one on an activated one.
Logged
Re: Floating Window
« Reply #1 on: January 13, 2009, 06:01:10 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 256
I'm not sure if you can actually get that type of behavior. It's not how windows treats well. Windows. You might be able to emulate what you want by handling the forums mouseover event to actively push that form to the front when you mouse over it.
Logged
  • My Myspace?
Re: Floating Window
« Reply #2 on: January 13, 2009, 06:13:49 pm »
  • The devil in the mirror.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 238
I'm not entirely sure what you're talking about(C++ programming?)
But I think making a tool-window as a child will give you the behavior you described(Having the parent in focus, automatically makes the tool-windows have focus)
I'm not sure, I just remember doing it once(If I'm correct on what you're trying that is ;) )
Logged
Working on my Masters Degree in Computer Science.
Hey look, Zelda Coop....later.
Proud user of C++ for 9 years, and counting!
Re: Floating Window
« Reply #3 on: January 14, 2009, 11:20:39 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
His icon is set to C#.

MDI Windy? Have the second window as an mdi form so both the main window and that are both activated.
Logged
the a o d c
Re: Floating Window
« Reply #4 on: January 14, 2009, 12:29:07 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
After trying many things I finally found out how to do it.

Code: [Select]
        private const uint WM_NCACTIVATE = 0x0086; // From Winuser.h
        private const uint WM_MOUSEACTIVATE = 0x21;
        private const uint MA_ACTIVATE = 1;

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_NCACTIVATE)
            {
                m.Result = (IntPtr)1; // return TRUE
                return;
            }
            else if (m.Msg == WM_MOUSEACTIVATE)
            {
                    m.Result = (IntPtr)MA_ACTIVATE;
            }
            // Process unhandled messages
            base.WndProc(ref m);
        }
the first one allows for the window to always appear activated, while the second one makes sure mouse events get processed when I activate the form by mouse click.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.039 seconds with 45 queries.