Announcement

Collapse
No announcement yet.

Resize listbox to dialog with PbForms

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

  • Resize listbox to dialog with PbForms

    How would you resize a listbox to match a dialog using PbForms?
    This is a very simple program to view a log file.
    The world is full of apathy, but who cares?

  • #2
    I don't know if PBForms offers some intrinsic feature to do this, but....

    Process WM_SIZE notification in your callback function.

    Use SetWindowPos or MoveWindow to resize and relocate the control.. or with DDT syntax, CONTROL SET LOC and/or CONTROL SET SIZE.

    The PBNote application supplied with the compiler might be a real good example to look at for this. That's SDK-style, but it shows what to do on WM_SIZE.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Thanks, that is what I needed.
      The world is full of apathy, but who cares?

      Comment


      • #4
        This works.

        'Should dialog be locked to avoid flicker? Would inbound messages be lost if it was locked?
        'Saw this posting by Borje and Lance.
        Code:
        'CALL CtrlRedraw(hWnd, %FALSE) 'Redraw off
        'Do something
        'CALL CtrlRedraw(hWnd, %TRUE) 'Redraw on, plus refresh
        FUNCTION CtrlRedraw( BYVAL hWnd AS LONG, BYVAL rDraw AS LONG) AS LONG
        CALL SendMessage(hWnd, %WM_SETREDRAW, rDraw, 0)
        IF rDraw THEN
        InvalidateRect hWnd, BYVAL %NULL, 0
        UpdateWindow hWnd
        END IF
        END FUNCTION



        Code:
        CASE %WM_SIZE
                  'Size listbox to client area at 0,0 or other position using DDT
                  IF CBWPARAM <> %SIZE_MINIMIZED THEN   'CBWPARMAM = wParam
                    LOCAL ClientX, ClientY, ControlX, ControlY AS LONG
                    DIALOG GET CLIENT CBHNDL                TO  ClientX, ClientY                'size of client area
                    CONTROL SET LOC CBHNDL, %IDC_LISTBOX1,  0,0                                 'optional
                    CONTROL GET LOC CBHNDL,  %IDC_LISTBOX1  TO ControlX, ControlY               'get location of control
                    CONTROL SET SIZE CBHNDL, %IDC_LISTBOX1, ClientX-ControlX, ClientY-ControlY  'resize to fit client area
                  END IF
                  EXIT FUNCTION
        Last edited by Mike Doty; 1 May 2008, 07:09 AM. Reason: Wanted to mention with DDT and PBForms.
        The world is full of apathy, but who cares?

        Comment

        Working...
        X