Announcement

Collapse
No announcement yet.

DDT dialog positioning...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DDT dialog positioning...

    Hello,

    Does anybody know how to reposition a dialog box via clicking and draging on the client area of a dialog. The reason I want to do this is because I am trying to reduce the amount of screen taken up by the dialog caption bar. So, I have a popup dialog without a caption and I would like to use the mouse to click and drag the dialog around the screen.

    -------------
    Cheers

  • #2
    Courtesy of Chris Boss...

    Code:
    SELECT CASE CBMSG     
           CASE %WM_LBUTTONDOWN       
               SendMessage ghDlg, %WM_NCLBUTTONDOWN, %HTCAPTION, BYVAL %NULL  
    END SELECT
    Regards, Jules
    Best regards
    Jules
    www.rpmarchildon.com

    Comment


    • #3
      Thank you ever so much!

      At first I wondered how this little snippet of code worked and I have to admit, I still don't. I will have to dig into this later but for now it works perfectly...

      ------------------
      Cheers

      Comment


      • #4
        Your'e vwelcome!

        Regards, Jules
        Best regards
        Jules
        www.rpmarchildon.com

        Comment


        • #5
          Mark;

          The code above "fools" Windows into thinking you clicked on the Caption Bar, even though it doesn't exist.

          Windows always "tests" to see where a mouse click occurs. By sending the %WM_NCHITTEST message, the window returns a value indicating whether the mouse click is on a sizable border, caption bar or the client area. The default window procedure will then process the mouse click based on "where" it occured.

          %WM_NCHITTEST returns %HTCAPTION if the mouse is clicked on the Title bar (caption bar). The default window procedure will impliment Window dragging when this happens. By "simulating" this by directly sending the Window the %WM_NCLBUTTONDOWN message with the %HTCAPTION value, you make Windows think you actually clicked on a real caption bar and window dragging is implimented.


          ------------------
          Chris Boss
          Computer Workshop
          Developer of "EZGUI"
          http://cwsof.com
          http://twitter.com/EZGUIProGuy

          Comment

          Working...
          X