Results 1 to 8 of 8

Thread: Creating photoshop-like toolbars

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Posts
    158

    Creating photoshop-like toolbars

    I'd like to use CreateWindowEx to create a toolbar type window which has a somewhat modal behavior as it will always appear over the main window frame, but the user can still interact with the main window as well as drag the toolbar outside the boundaries of the main window frame.

    Using WS_EX_TOPMOST will provide this effect, but obviously has the undesirable effect of hovering over other apps as well.

    I'd assume I can create the desired effect using CreateDialog but I'd rather not because I want to create my toolbars on the fly at runtime and I don't want to create any templates - it's just too cumbersome.

    Anyone know how they acheived this effect for the photoshop toolbars and how I might go about doing it?

    thanks!

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Creating photoshop-like toolbars

    I believe Photoshop uses WS_EX_TOPMOST, but hides the toolbars when it loses focus and shows them again on gaining focus.
    That's what Visual Studio does, anyway.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Posts
    158

    Re: Creating photoshop-like toolbars

    Hi Corned Bee,

    Actually, photoshop does keep the toolbars visible, even when the app loses focus. I've attempted changing HWND_TOPMOST to HWND_NOTOPMOST after various messages such as WM_ACTIVATEAPP, but with no luck.

    If anyone figures this out, I'd be glad to know!

  4. #4
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048

    Re: Creating photoshop-like toolbars

    have you tried WM_KILLFOCUS?

    also, try using spy++ to get the style(s) of the of the toolbar

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Posts
    158

    Re: Creating photoshop-like toolbars

    ok, this is still unresolved, and i'm still researching, but with no luck.

    dis1411, WM_KILLFOCUS won't change the topmost property of the window when focus has changed to another app.

    also, i used spy++ to check the messages and styles of the of the toolbar. the styles are:

    WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER | WS_OVERLAPPED | 00000011
    (not sure what the last one equates to)

    Extended styles:
    WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_TOOLWINDOW

    There are too many messages to list, but i gave a few a try when switching the topmost/nottopmost properties of the windows and WM_WINDOWPOSCHANGED setting topmost and WM_ACTIVATEAPP setting nottopmost gave me the closest results - but it's still not quite right yet.

    There's a lot of strange behavior when trying to set focus on the main window or move it, so i know this isn't exactly how they approached it.

    Well, that's as far as I've gotten. If anyone can lend their win32 api expertise, i'd be gratefull!

  6. #6
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Creating photoshop-like toolbars

    Quote Originally Posted by printf
    ok, this is still unresolved, and i'm still researching, but with no luck.

    dis1411, WM_KILLFOCUS won't change the topmost property of the window when focus has changed to another app.

    also, i used spy++ to check the messages and styles of the of the toolbar. the styles are:

    WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER | WS_OVERLAPPED | 00000011
    (not sure what the last one equates to)

    Extended styles:
    WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_TOOLWINDOW

    There are too many messages to list, but i gave a few a try when switching the topmost/nottopmost properties of the windows and WM_WINDOWPOSCHANGED setting topmost and WM_ACTIVATEAPP setting nottopmost gave me the closest results - but it's still not quite right yet.

    There's a lot of strange behavior when trying to set focus on the main window or move it, so i know this isn't exactly how they approached it.

    Well, that's as far as I've gotten. If anyone can lend their win32 api expertise, i'd be gratefull!
    When your app loses focus could you just destroy the toolbar window/s and then create them on focus again? You would obviously need some way of keeping track of what windows were open though.

    Could this be too memory hungry though?

    p.s. I am new to C/C++ so please excuse me if i am talking rubbish.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Creating photoshop-like toolbars

    I already recommended that (well, actually I recommended hiding and showing), but that's not the effect he wants.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Creating photoshop-like toolbars

    Sorry i should have read the whole post too, i never saw your post Corned Bee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width