Announcement

Collapse
No announcement yet.

Resizing dialog

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

  • Resizing dialog

    Is there an easy way to resize a DDT dialog window? I want to add a button
    to the dialog to change the dialog size. I need to show some additional
    controls then. (The button must 'flip' between 2 dialog sizes, say 400x300
    and 400x400). Or would it be easier to create 2 dialog windows?


    ------------------
    Peter.
    mailto[email protected][email protected]</A>

    [This message has been edited by Peter Lameijn (edited April 15, 2001).]
    Regards,
    Peter

  • #2
    This piece resizes the status bar, use a control send w/WM_SIZE and the appropriate size and you can do it...
    This window I am using is NOT a DDT, therefore I just used the sendmessage..
    Code:
        Case %WM_SIZE
            Local Xsize           As Long
            Local Ysize           As Long
            GetClientRect g_hWndMain, WndRect
            Xsize = WndRect.nRight - WndRect.nLeft
            Ysize = WndRect.nBottom - WndRect.nTop
            If IsWindowVisible(g_hStatus) Then
                SendMessage g_hStatus, %WM_SIZE, wParam, lParam
                ShowWindow g_hStatus, %SW_NORMAL
                If IsWindowVisible(g_hListView) Then SetWindowPos g_hListView, 0, 0, 0, XSize, YSize-20, %SWP_NOMOVE Or %SWP_NOZORDER Or %SWP_DRAWFRAME
            Else
                If IsWindowVisible(g_hListView) Then SetWindowPos g_hListView, 0, 0, 0, XSize, YSize, %SWP_NOMOVE Or %SWP_NOZORDER Or %SWP_DRAWFRAME
            End If
            Function = 0
            Exit Function
    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      You can use DIALOG SET SIZE for this, like:
      Code:
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      ' Declares
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      #COMPILE EXE
      #INCLUDE "WIN32API.INC"
      DECLARE CALLBACK FUNCTION DlgProc() AS LONG
       
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      ' Create dialog and controls, etc
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      FUNCTION PBMAIN () AS LONG
        LOCAL hDlg AS LONG
        DIALOG NEW 0, "Resize sample",,, 195, 50, %WS_CAPTION OR %WS_SYSMENU TO hDlg
        CONTROL ADD BUTTON, hDlg, 10, "&Increase hight",  4,  4, 60, 14
        CONTROL ADD BUTTON, hDlg, 11, "&Reset size",     64,  4, 60, 14
        CONTROL ADD BUTTON, hDlg, 12, "E&xit",          130,  4, 60, 14
        DIALOG SHOW MODAL hDlg CALL DlgProc
      END FUNCTION
       
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      ' Main callback
      '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      CALLBACK FUNCTION DlgProc() AS LONG
        IF CBMSG = %WM_INITDIALOG THEN
           STATIC W AS LONG, H AS LONG
           DIALOG GET SIZE CBHNDL TO W, H       'get and store original size
       
        ELSEIF CBMSG = %WM_COMMAND THEN
           IF CBCTL = 10 THEN
              DIALOG SET SIZE CBHNDL, W, H + 50 'original size + 50
           ELSEIF CBCTL = 11 THEN
              DIALOG SET SIZE CBHNDL, W, H      'original size
           ELSEIF CBCTL = 12 THEN
             DIALOG END CBHNDL
           END IF
        END IF
      END FUNCTION

      ------------------

      Comment

      Working...
      X