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#
  4. Modeless Dialogs

Modeless Dialogs

Scheduled Pinned Locked Moved C#
csharpc++dotnetvisual-studiolinux
5 Posts 3 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.
  • J Offline
    J Offline
    Jeff J
    wrote on last edited by
    #1

    Has anyone succeeded in spawning a modeless dialog that stays on top of the main form, but that does not just stay on top of every window in the shell? That is, behaviour identical to Find/Replace dialogs in VS and Office. In C++ this is routine, but in .Net I have failed when: 1) Setting dialog's TopLevel to false, and making dialog a child of main form. This only allows rendering the dialog within the client area of the main form, of course, since it is treated as a non-form child control. 2) Using Win32 API SetParent() and SetWindowPos() directly. The dialog freezes and paints garbage. CLR does not recognise Windows' way of setting parent-child relationships, I suspect, and proper message handling requires the dialog to be in the parent's collection. I am investigating some wild hacks, but would appreciate it if anyone has insights on this. TIA

    C 1 Reply Last reply
    0
    • J Jeff J

      Has anyone succeeded in spawning a modeless dialog that stays on top of the main form, but that does not just stay on top of every window in the shell? That is, behaviour identical to Find/Replace dialogs in VS and Office. In C++ this is routine, but in .Net I have failed when: 1) Setting dialog's TopLevel to false, and making dialog a child of main form. This only allows rendering the dialog within the client area of the main form, of course, since it is treated as a non-form child control. 2) Using Win32 API SetParent() and SetWindowPos() directly. The dialog freezes and paints garbage. CLR does not recognise Windows' way of setting parent-child relationships, I suspect, and proper message handling requires the dialog to be in the parent's collection. I am investigating some wild hacks, but would appreciate it if anyone has insights on this. TIA

      C Offline
      C Offline
      Chris Jobson
      wrote on last edited by
      #2

      Not sure if it's the right way, but the following works for me: Set the dialog's ShowInTaskBar property false, and after creating the dialog (in some method of the main form) call MainForm.AddOwnedForm(DialogForm). Chris Jobson

      J J 2 Replies Last reply
      0
      • C Chris Jobson

        Not sure if it's the right way, but the following works for me: Set the dialog's ShowInTaskBar property false, and after creating the dialog (in some method of the main form) call MainForm.AddOwnedForm(DialogForm). Chris Jobson

        J Offline
        J Offline
        James T Johnson
        wrote on last edited by
        #3

        Chris Jobson wrote: Not sure if it's the right way Going from memory, the docs for AddOwnedForm say that is what it does so I would say that is The Right Way™ :) James "It is self repeating, of unknown pattern" Data - Star Trek: The Next Generation

        J 1 Reply Last reply
        0
        • C Chris Jobson

          Not sure if it's the right way, but the following works for me: Set the dialog's ShowInTaskBar property false, and after creating the dialog (in some method of the main form) call MainForm.AddOwnedForm(DialogForm). Chris Jobson

          J Offline
          J Offline
          Jeff J
          wrote on last edited by
          #4

          Thank you Chris, that's exactly what the doctor ordered :) It's a pleasure to have contributors such as yourself on CP. Incredible that I overlooked that in the docs; probably scanned the protected methods too quickly, and got lost in keyword searches! Cheers

          1 Reply Last reply
          0
          • J James T Johnson

            Chris Jobson wrote: Not sure if it's the right way Going from memory, the docs for AddOwnedForm say that is what it does so I would say that is The Right Way™ :) James "It is self repeating, of unknown pattern" Data - Star Trek: The Next Generation

            J Offline
            J Offline
            Jeff J
            wrote on last edited by
            #5

            Thanks for your support too, James. Cheers

            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