Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to make topmost control on dialog? [modified]

How to make topmost control on dialog? [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aragornx
    wrote on last edited by
    #1

    Hi I'm creating my own control. I dynamically creating CListBox over the other controls - it's my combo list control. My problem is that controls from behind my CListBox (eg. CEdit controls) getting to front. It disturbs everything. I tried to use myList.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ) - but it's not working. Is there any way to make control topmost (something like modal dialog) over other controls. Plaese help...

    modified on Tuesday, December 9, 2008 7:17 AM

    K B K 3 Replies Last reply
    0
    • A aragornx

      Hi I'm creating my own control. I dynamically creating CListBox over the other controls - it's my combo list control. My problem is that controls from behind my CListBox (eg. CEdit controls) getting to front. It disturbs everything. I tried to use myList.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ) - but it's not working. Is there any way to make control topmost (something like modal dialog) over other controls. Plaese help...

      modified on Tuesday, December 9, 2008 7:17 AM

      K Offline
      K Offline
      K Sushilkumar
      wrote on last edited by
      #2

      I am not sure but you can have a try, You need to SetWindowPos for all the controls that intersect with your listbox. The call should be in the same order you would like to. Ex. SetWindowPos(EDIT_1) SetWindowPos(EDIT_2) SetWindowPos(LISTBOX) //Top-most.

      1 Reply Last reply
      0
      • A aragornx

        Hi I'm creating my own control. I dynamically creating CListBox over the other controls - it's my combo list control. My problem is that controls from behind my CListBox (eg. CEdit controls) getting to front. It disturbs everything. I tried to use myList.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ) - but it's not working. Is there any way to make control topmost (something like modal dialog) over other controls. Plaese help...

        modified on Tuesday, December 9, 2008 7:17 AM

        B Offline
        B Offline
        BadJerry
        wrote on last edited by
        #3

        I believe that wndTopMost is intended for windows (usually modeless dialog boxes) and not child indows (eg controls). Simply use wndTop and it should do the trick!

        A 1 Reply Last reply
        0
        • B BadJerry

          I believe that wndTopMost is intended for windows (usually modeless dialog boxes) and not child indows (eg controls). Simply use wndTop and it should do the trick!

          A Offline
          A Offline
          aragornx
          wrote on last edited by
          #4

          sorry - but it's not working: picture two first - wndTopMost, third - wndTop - still no solution :( some code from my control (derived form CEdit): lista - derived from (CListBox): lista.Create( WS_CHILD|WS_VISIBLE|LBS_STANDARD|WS_HSCROLL|LBS_NOTIFY, CRect( rect.left, rect.bottom, rect.right,rect.bottom+100), parentWindow, IDC_LISTBOX ); lista.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

          Y 1 Reply Last reply
          0
          • A aragornx

            sorry - but it's not working: picture two first - wndTopMost, third - wndTop - still no solution :( some code from my control (derived form CEdit): lista - derived from (CListBox): lista.Create( WS_CHILD|WS_VISIBLE|LBS_STANDARD|WS_HSCROLL|LBS_NOTIFY, CRect( rect.left, rect.bottom, rect.right,rect.bottom+100), parentWindow, IDC_LISTBOX ); lista.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

            Y Offline
            Y Offline
            Y K Kishore Kumar
            wrote on last edited by
            #5

            Hi, Did you find any solution for this finally ? I am having the same problem now. Thanks...

            1 Reply Last reply
            0
            • A aragornx

              Hi I'm creating my own control. I dynamically creating CListBox over the other controls - it's my combo list control. My problem is that controls from behind my CListBox (eg. CEdit controls) getting to front. It disturbs everything. I tried to use myList.SetWindowPos( &CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ) - but it's not working. Is there any way to make control topmost (something like modal dialog) over other controls. Plaese help...

              modified on Tuesday, December 9, 2008 7:17 AM

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              Check the tab-order (Strg+D) in the resource view of VS, or change the order in the rc-dile

              Press F1 for help or google it. Greetings from Germany

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups