Announcement

Collapse
No announcement yet.

PB8.04 broke my app

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

  • PB8.04 broke my app

    Well, not really broken but there ARE some significant differences.

    Compile the example below with PB8.03 and note the text sizes shown in the message boxes when button 1 is pressed.

    Why are they different with PB8.04?

    Also note the difference in behavior by following the instructions in the Graphic control. This is really causing some difficulties in my app.

    Code:
    COMPILE EXE
    #DIM ALL
    
    '------------------------------------------------------------------------------
    '   ** Includes **
    '------------------------------------------------------------------------------
    %USEMACROS = 1
    #INCLUDE "WIN32API.INC"
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Constants **
    '------------------------------------------------------------------------------
    %IDD_DIALOG1    =  101
    %IDC_GRAPHIC1   = 1000
    %IDC_LFT_1      = 2010
    %IDC_LFT_2      = 2011
    %IDC_WRN2_LBL1  = 3001
    %IDC_WRN2_LBL2  = 3002
    %IDC_WRN2_YES   = 3010
    %IDC_WRN2_NO    = 3011
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE CALLBACK FUNCTION ShowLFTProc()
    DECLARE CALLBACK FUNCTION ShowWARN2Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    DECLARE FUNCTION ShowLFT(BYVAL hParent AS DWORD) AS LONG
    DECLARE FUNCTION ShowWARN2(BYVAL hParent AS DWORD, BYVAL info AS STRING) AS LONG
    DECLARE FUNCTION MakeFont(BYVAL sFntName AS STRING, BYVAL fFntSize AS LONG, _
     BYVAL lWeight AS LONG, BYVAL lUnderlined AS BYTE, BYVAL lItalic AS BYTE, _
     BYVAL lStrike AS BYTE, BYVAL lCharSet AS BYTE, BYVAL lRotation AS INTEGER) AS LONG
    
    GLOBAL gMAINhndl, gWARN2hndl AS LONG
    GLOBAL ghFont() AS DWORD    'fonts used in various dialogs
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
        REDIM ghFont(1) AS GLOBAL DWORD
        'normal larger font
        ghFont(0) = MakeFont("Arial", 10, %FW_NORMAL, %FALSE, %FALSE, %FALSE, %ANSI_CHARSET, 0)
        'bold normal, larger font
        ghFont(1) = MakeFont("Arial", 10, %FW_SEMIBOLD, %FALSE, %FALSE, %FALSE, %ANSI_CHARSET, 0)
        DIALOG FONT "Arial", 8
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                ' Initialization handler
                ShowLFT(CBHNDL)
    
            'CASE %WM_NCACTIVATE
            '    STATIC hWndSaveFocus AS DWORD
            '    IF ISFALSE CBWPARAM THEN
            '        ' Save control focus
            '        hWndSaveFocus = GetFocus()
            '    ELSEIF hWndSaveFocus THEN
            '        ' Restore control focus
            '        SetFocus(hWndSaveFocus)
            '        hWndSaveFocus = 0
            '    END IF
    
            CASE %WM_COMMAND
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_GRAPHIC1
                END SELECT
            CASE %WM_DESTROY
                DeleteObject ghFont(0)
                DeleteObject ghFont(1)
    
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowLFTProc()
        LOCAL i AS LONG
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
    
            CASE %WM_COMMAND
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_LFT_1
                        CONTROL GET CHECK CBHNDL, CBCTL TO i
                        IF i THEN
                            ShowWarn2(gMAINhndl,"ARE YOU SURE?,Really Sure?")
                        ELSE
                            DIALOG END gWARN2hndl
                        END IF
                    CASE %IDC_LFT_2
                        'beep
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowWARN2Proc()
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
    
            CASE %WM_COMMAND
                IF CBCTLMSG = %BN_CLICKED THEN
                    SELECT CASE AS LONG CBCTL
                        CASE %IDC_WRN2_YES
                            DIALOG END CBHNDL, 1    'signal YES
                        CASE %IDC_WRN2_NO
                            DIALOG END CBHNDL, 0    'signal NO
                    END SELECT
                END IF
            CASE %WM_DESTROY
                gWARN2hndl = 0
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS DWORD, x, y AS LONG
    
        DIALOG NEW hParent, "PB8.04/03 TEST", 259, 173, 201, 121, %WS_POPUP OR _
         %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
         %WS_CLIPCHILDREN OR %WS_VISIBLE OR %DS_MODALFRAME 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 gMAINhndl
        CONTROL ADD GRAPHIC, gMAINhndl, %IDC_GRAPHIC1, "", 35, 0, 165, 120, %WS_CHILD OR _
         %WS_VISIBLE  OR %WS_CLIPSIBLINGS OR %SS_NOTIFY, %WS_EX_CLIENTEDGE
        GRAPHIC ATTACH gMAINhndl, %IDC_GRAPHIC1, REDRAW  'select/buffer graphic control
    
        'scale graphic to pixels here
        GRAPHIC GET CLIENT TO x, y
        DIALOG UNITS gMAINhndl, x, y TO PIXELS x, y
        GRAPHIC SCALE (0,0) - (x,y)
        GRAPHIC SET POS (60, 15)
        GRAPHIC PRINT "GRAPHIC CONTROL"
        GRAPHIC SET POS (5, 140)
        GRAPHIC PRINT "Click on Graphic Control:"
        GRAPHIC SET POS (5, 160)
        GRAPHIC PRINT "PB8.03 Pressing 1 or 2 on keyboard activates"
        GRAPHIC SET POS (5, 180)
        GRAPHIC PRINT "buttons.  PB8.04 does NOT"
    
                                                                                            
        DIALOG SHOW MODAL gMAINhndl, CALL ShowDIALOG1Proc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    'Left Button Strip
    FUNCTION ShowLFT(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt, hDlg, y AS LONG
    
        DIALOG NEW hParent, "", 2, 2, 33, 118, %WS_CHILD OR %WS_VISIBLE OR _
         %WS_CLIPSIBLINGS OR %DS_CONTROL 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 CHECKBOX, hDlg, %IDC_LFT_1, "&1", 0, 0, 31, 12, _
         %WS_VISIBLE OR %WS_TABSTOP OR %BS_PUSHLIKE OR %BS_CENTER OR %BS_VCENTER OR %WS_GROUP
        CONTROL ADD CHECKBOX, hDlg, %IDC_LFT_2, "&2", 0, 12, 31, 12, _
         %WS_VISIBLE OR %WS_TABSTOP OR %BS_PUSHLIKE OR %BS_CENTER OR %BS_VCENTER OR %WS_GROUP
    
        SetWindowPos hDlg, %HWND_TOP, 0, 0, 0, 0, %SWP_NOMOVE OR %SWP_NOSIZE
        DIALOG SHOW MODELESS hDlg, CALL ShowLFTProc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
    
     '------------------------------------------------------------------------------
    'displays WARNING dialog with Yes/No buttons
    FUNCTION ShowWARN2(BYVAL hParent AS DWORD, BYVAL info AS STRING) AS LONG
        LOCAL x, y, x1, y1 AS LONG, t1, t2 AS STRING
    
        'get size of text to be printed - 1st line
        t1 = PARSE$(info, 1)
        GRAPHIC FONT "Arial", 10, 1
        GRAPHIC TEXT SIZE t1 TO x, y
    MSGBOX "Text length (pixels): " + FORMAT$(x)
        DIALOG PIXELS hParent, x, y TO UNITS x, y
    MSGBOX "Text length (units): " + FORMAT$(x)
        t2 = PARSE$(info, 2)
        GRAPHIC FONT "Arial", 10, 0
        GRAPHIC TEXT SIZE t2 TO x1, y1
        DIALOG PIXELS hParent, x1, y1 TO UNITS x1, y1
        'where to print?
        x = MAX(x, x1): y = MAX(y, y1)     'use the larger
        DIALOG NEW hParent, "", 20, 40, x + 47, 32, %WS_CHILD OR %WS_CLIPSIBLINGS OR _
         %WS_VISIBLE OR %WS_BORDER, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
         %WS_EX_RIGHTSCROLLBAR, TO gWARN2hndl
        DIALOG  SET COLOR gWARN2hndl,  -1, RGB(255, 155, 172)
        CONTROL ADD LABEL, gWARN2hndl, %IDC_WRN2_LBL1, t1, 9, 2, x + 5, 13, %WS_CHILD OR _
         %WS_VISIBLE OR %SS_CENTERIMAGE OR %SS_CENTER, %WS_EX_LEFT OR %WS_EX_LTRREADING
        CONTROL SET COLOR gWARN2hndl, %IDC_WRN2_LBL1, %BLACK, -2
        CONTROL ADD LABEL, gWARN2hndl, %IDC_WRN2_LBL2, t2, 9, 15, x + 5, 13, %WS_CHILD OR _
         %WS_VISIBLE OR %SS_CENTERIMAGE OR %SS_CENTER, %WS_EX_LEFT OR %WS_EX_LTRREADING
        CONTROL SET COLOR gWARN2hndl, %IDC_WRN2_LBL2, %WHITE, -2
        CONTROL ADD BUTTON, gWARN2hndl, %IDC_WRN2_YES, "&Yes", x + 21, 2, 24, 14
        CONTROL ADD BUTTON, gWARN2hndl, %IDC_WRN2_NO, "&No", x + 21, 16, 24, 14
    
        CONTROL SEND gWARN2hndl, %IDC_WRN2_LBL1, %WM_SETFONT, ghFont(1), 0
        CONTROL SEND gWARN2hndl, %IDC_WRN2_LBL2, %WM_SETFONT, ghFont(0), 0
        CONTROL SEND gWARN2hndl, %IDC_WRN2_YES, %WM_SETFONT, ghFont(0), 0
        CONTROL SEND gWARN2hndl, %IDC_WRN2_NO, %WM_SETFONT, ghFont(0), 0
    
        SetWindowPos gWARN2hndl, %HWND_TOP, 0, 0, 0, 0, %SWP_NOMOVE OR %SWP_NOSIZE
        DIALOG SHOW MODELESS gWARN2hndl, CALL ShowWARN2Proc TO x
        'DO
        '    DIALOG DOEVENTS
        'LOOP UNTIL gWARN2hndl = 0
    
    
        FUNCTION = x
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    FUNCTION MakeFont(BYVAL sFntName AS STRING, BYVAL fFntSize AS LONG, _
     BYVAL lWeight AS LONG, BYVAL lUnderlined AS BYTE, BYVAL lItalic AS BYTE, _
     BYVAL lStrike AS BYTE, BYVAL lCharSet AS BYTE, BYVAL lRotation AS INTEGER) AS LONG
        DIM lf AS LOGFONT
        LOCAL hDC AS DWORD, lCyPixels AS LONG
    
        hDC = GetDC(%HWND_DESKTOP)
        lCyPixels = GetDeviceCaps(hDC, %LOGPIXELSY)
        ReleaseDC(%HWND_DESKTOP, hDC)
    
        lf.lfHeight = -(fFntSize * lCyPixels) \ 72
        lf.lfFaceName = sFntName
        lf.lfPitchAndFamily = %FF_DONTCARE
        IF lWeight = %FW_DONTCARE THEN
            lf.lfWeight = %FW_NORMAL
        ELSE
            lf.lfWeight = lWeight
        END IF
        lf.lfUnderline = lUnderlined
        lf.lfItalic = lItalic
        lf.lfStrikeOut = lStrike
        lf.lfCharSet = lCharSet
        lf.lfescapement  = lRotation * 10
        lf.lforientation = lRotation * 10
        FUNCTION = CreateFontIndirect(lf)
    END FUNCTION
    '------------------------------------------------------------------------------

  • #2
    Remove the SS_NOTIFY style from the graphic control, unless you need it.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Kev,

      I need it it my 'real' app., but that doesn't explain why there is a difference in behavior in 8.04 vs 8.03.

      Thanks for your comment.

      Comment


      • #4
        Bill,

        I didn't know whether you wanted a workaround for this or no.

        I can't speak for PB, but something could have changed in the internal callback for the graphic control. Possibly, you could subclass the control and handle the WM_GETDLGCODE message yourself. This message tells Windows which keys are to be handled by the control and which keys handled by the dialog. In the subclass proc, returning zero to this message should give keyboard handling back to the dialog and solve your problem.
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          >but that doesn't explain why there is a difference in behavior in 8.04 vs 8.03.

          I have not partaken of the update yet, but perhaps there is something in the history.txt file which would tell you?

          MCM
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            No: history.txt reports only about new 32bit compiler.
            thinBasic programming language
            Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

            Comment

            Working...
            X