Announcement

Collapse
No announcement yet.

Placing Text at the Bottom Center of a Frame

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

  • Placing Text at the Bottom Center of a Frame

    Is it possible to place a frame's text at the bottom center of the frame?
    If so, How?

  • #2
    Can you place a Contol Add Label where you want the text to be (after the Frame is drawn)?

    ====================================================
    "Any man who is under 30 and not a liberal,
    has not heart;
    and any man who over 30, and is not a conservative,
    has no brains."
    Sir Winston Churchill (1874-1965)
    ====================================================
    It's a pretty day. I hope you enjoy it.

    Gösta

    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

    Comment


    • #3
      Code:
       
      
      '----------------------------------------------------------------------------(')
       
      #COMPILE EXE
      #DIM ALL
      #IF NOT %DEF( %WINAPI )
       #INCLUDE "WIN32API.INC"
      #ENDIF
       
      '----------------------------------------------------------------------------(')
       
      %dlgTestDialog = 1001
      %frmFrame = 1002
      %lblText = 1003
       
      '----------------------------------------------------------------------------(')
       
      CALLBACK FUNCTION ShowdlgTestDialogProc( )
       SELECT CASE AS LONG CBMSG
        CASE %WM_NCACTIVATE
         STATIC hWndSaveFocus AS DWORD
         IF ISFALSE CBWPARAM THEN
          hWndSaveFocus = GETFOCUS( )
         ELSEIF hWndSaveFocus THEN
          SETFOCUS( hWndSaveFocus )
          hWndSaveFocus = 0
         END IF
       END SELECT
      END FUNCTION
       
      '----------------------------------------------------------------------------(')
       
      FUNCTION PBMAIN( ) AS LONG
       LOCAL lngResult AS LONG
       LOCAL hDlg AS DWORD
       DIALOG NEW %HWND_DESKTOP, "Test Dialog", 70, 70, 201, 121, %WS_POPUP OR _
         %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
         %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME _
         OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
         %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
         %WS_EX_RIGHTSCROLLBAR, TO hDlg
       CONTROL ADD FRAME, hDlg, %frmFrame, "", 7, 7, 182, 100
       CONTROL ADD LABEL, hDlg, %lblText, "Like This?", 77, 102, 49, 10, _
         %WS_CHILD OR %WS_VISIBLE OR %SS_CENTER OR %SS_CENTERIMAGE, _
         %WS_EX_LEFT OR %WS_EX_LTRREADING
       DIALOG SHOW MODAL hDlg, CALL ShowdlgTestDialogProc TO lngResult
       FUNCTION = lngResult
      END FUNCTION
      <b>George W. Bleck</b>
      <img src='http://www.blecktech.com/myemail.gif'>

      Comment


      • #4
        Small mod to George's code takes care of redraw - required if window looses focus and / or is partially visible (without mod the frame shows through the label) ..
        Code:
        CALLBACK FUNCTION ShowdlgTestDialogProc( )
         SELECT CASE AS LONG CBMSG
          CASE %WM_NCACTIVATE
           STATIC hWndSaveFocus AS DWORD
           IF ISFALSE CBWPARAM THEN
            hWndSaveFocus = GETFOCUS( )
            DIALOG POST CBHNDL, %WM_USER + 1000, 0, 0
           ELSEIF hWndSaveFocus THEN
            SETFOCUS( hWndSaveFocus )
            hWndSaveFocus = 0
           END IF
          CASE %WM_USER + 1000
            CONTROL REDRAW CBHNDL, %lblText
         END SELECT
        END FUNCTION
        Rgds, Dave

        Comment


        • #5
          Odd you require that redraw where I do not. I can move my dialog, minimize it, cover it with other windows, half push it off screen, it always draws correctly.
          <b>George W. Bleck</b>
          <img src='http://www.blecktech.com/myemail.gif'>

          Comment


          • #6
            It is a bit odd.



            This is using AMD Athlon 64 X2 WinXP Home SP2, PBWin901.
            It's painted normally until the window looses focus.. Comes good without the fix, if the window is dragged partly off screen, forcing a repaint of the label.
            Rgds, Dave

            Comment


            • #7
              I see why... when I cut/paste my code I had stale data on the clipboard. The below code is the code I tested. Notice the order change of the controls and the %WS_EX_TRANSPARENT on the label.

              Code:
               
              
              '----------------------------------------------------------------------------(')
               
              #COMPILE EXE
              #DIM ALL
              #IF NOT %DEF( %WINAPI )
               #INCLUDE "WIN32API.INC"
              #ENDIF
               
              '----------------------------------------------------------------------------(')
               
              %dlgTestDialog = 1001
              %frmFrame = 1002
              %lblText = 1003
               
              '----------------------------------------------------------------------------(')
               
              CALLBACK FUNCTION ShowdlgTestDialogProc( )
               SELECT CASE AS LONG CBMSG
                CASE %WM_NCACTIVATE
                 STATIC hWndSaveFocus AS DWORD
                 IF ISFALSE CBWPARAM THEN
                  hWndSaveFocus = GETFOCUS( )
                 ELSEIF hWndSaveFocus THEN
                  SETFOCUS( hWndSaveFocus )
                  hWndSaveFocus = 0
                 END IF
               END SELECT
              END FUNCTION
               
              '----------------------------------------------------------------------------(')
               
              FUNCTION PBMAIN( ) AS LONG
               LOCAL lngResult AS LONG
               LOCAL hDlg AS DWORD
               DIALOG NEW %HWND_DESKTOP, "Test Dialog", 70, 70, 201, 121, %WS_POPUP OR _
                 %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                 %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME _
                 OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                 %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                 %WS_EX_RIGHTSCROLLBAR, TO hDlg
               CONTROL ADD LABEL, hDlg, %lblText, "Like This?", 77, 102, 49, 10, _
                 %WS_CHILD OR %WS_VISIBLE OR %SS_CENTER OR %SS_CENTERIMAGE, _
                 %WS_EX_TRANSPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING
               CONTROL ADD FRAME, hDlg, %frmFrame, "", 7, 7, 182, 100
               DIALOG SHOW MODAL hDlg, CALL ShowdlgTestDialogProc TO lngResult
               FUNCTION = lngResult
              END FUNCTION
              <b>George W. Bleck</b>
              <img src='http://www.blecktech.com/myemail.gif'>

              Comment


              • #8
                Ah yes - that's better
                Rgds, Dave

                Comment


                • #9
                  Many Thanks Gentlemen.

                  Comment

                  Working...
                  X