Announcement

Collapse
No announcement yet.

%SS_SIMPLE ISSUE or %SS_SIMPLE FUN?

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

  • %SS_SIMPLE ISSUE or %SS_SIMPLE FUN?

    I have recently discovered that a label with the %SS_SIMPLE style does not clear when a CONTROL SET TEXT is sent with "" as the string parameter whereas a label without that style does. A string of spaces will do the job, but it seems inconsistent to me.

    Before I send anything to PB, I thought I would post some code to display the 'issue' and see if others thought it ..uh.. unusual?
    Code:
    #PBFORMS CREATED V1.51
    '--------------------------------------------------------------------------------------------------
    ' The first line in this file is a PB/Forms metastatement.
    ' It should ALWAYS be the first line of the file. Other
    ' PB/Forms metastatements are placed at the beginning and
    ' end of "Named Blocks" of code that should be edited
    ' with PBForms only. Do not manually edit or delete these
    ' metastatements or PB/Forms will not be able to reread
    ' the file correctly.  See the PB/Forms documentation for
    ' more information.
    ' Named blocks begin like this:    #PBFORMS BEGIN ...
    ' Named blocks end like this:      #PBFORMS END ...
    ' Other PB/Forms metastatements such as:
    '     #PBFORMS DECLARATIONS
    ' are used by PB/Forms to insert additional code.
    ' Feel free to make changes anywhere else in the file.
    '--------------------------------------------------------------------------------------------------
    
    #COMPILE EXE
    #DIM ALL
    
    '--------------------------------------------------------------------------------------------------
    '   ** Includes **
    '--------------------------------------------------------------------------------------------------
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
      #INCLUDE "WIN32API.INC"
    #ENDIF
    #PBFORMS END INCLUDES
    '--------------------------------------------------------------------------------------------------
    
    '--------------------------------------------------------------------------------------------------
    '   ** Constants **
    '--------------------------------------------------------------------------------------------------
    #PBFORMS BEGIN CONSTANTS
    %IDCANCEL    =    2
    %IDD_DIALOG1 =  101
    %IDC_LABEL1  = 1001
    %IDC_LABEL2  = 1002
    %IDC_LABEL3  = 1003
    %IDC_LABEL4  = 1004
    %IDC_NEXT    = 1005
    #PBFORMS END CONSTANTS
    '--------------------------------------------------------------------------------------------------
    
    '--------------------------------------------------------------------------------------------------
    '   ** Declarations **
    '--------------------------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    '--------------------------------------------------------------------------------------------------
    
    '--------------------------------------------------------------------------------------------------
    '   ** Main Application Entry Point **
    '--------------------------------------------------------------------------------------------------
    FUNCTION PBMAIN()
      ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '--------------------------------------------------------------------------------------------------
    
    '--------------------------------------------------------------------------------------------------
    '   ** CallBacks **
    '--------------------------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
    LOCAL statement,ss AS STRING
    STATIC index AS LONG
    statement="These two labels are the same only different, can you tell?
      SELECT CASE AS LONG CBMSG
        CASE %WM_INITDIALOG
          ' Initialization handler
    
        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
          ' Process control notifications
          SELECT CASE AS LONG CBCTL
            CASE %IDC_LABEL1
    
            CASE %IDC_LABEL2
    
            CASE %IDC_LABEL3
    
            CASE %IDC_LABEL4
    
            CASE %IDC_NEXT
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                INCR index
                ss=PARSE$(statement," ",index)
                CONTROL SET TEXT CB.HNDL, %IDC_LABEL2, ""
                CONTROL REDRAW CB.HNDL, %IDC_LABEL2
                CONTROL SET TEXT CB.HNDL, %IDC_LABEL2, ss
                
                CONTROL SET TEXT CB.HNDL, %IDC_LABEL4, ""
                CONTROL REDRAW CB.HNDL, %IDC_LABEL4
                CONTROL SET TEXT CB.HNDL, %IDC_LABEL4, ss
                IF index=11 THEN index=0
                'MSGBOX "%IDC_NEXT=" + FORMAT$(%IDC_NEXT), %MB_TASKMODAL
              END IF
    
            CASE %IDCANCEL
              IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                DIALOG END CBHNDL, 0
              END IF
    
          END SELECT
      END SELECT
    END FUNCTION
    '--------------------------------------------------------------------------------------------------
    
    '--------------------------------------------------------------------------------------------------
    '   ** Dialogs **
    '--------------------------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
      LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
      LOCAL hDlg  AS DWORD
    
      DIALOG NEW hParent, "%SS_SIMPLE FUN", 215, 76, 524, 121, %WS_POPUP OR %WS_BORDER OR _
        %WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_ABSALIGN 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 hDlg
      CONTROL ADD LABEL,  hDlg, %IDC_LABEL1, "With %SS_SIMPLE", 5, 10, 100, 10
      CONTROL ADD LABEL,  hDlg, %IDC_LABEL2, "", 5, 20, 200, 15, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT _
        OR %SS_CENTERIMAGE OR %SS_SIMPLE, %WS_EX_LEFT OR %WS_EX_LTRREADING
      CONTROL SET COLOR   hDlg, %IDC_LABEL2, -1, %LTGRAY
      CONTROL ADD LABEL,  hDlg, %IDC_LABEL3, "Without %SS_Simple", 5, 40, 100, 10
      CONTROL ADD LABEL,  hDlg, %IDC_LABEL4, "", 5, 50, 200, 15, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT _
        OR %SS_CENTERIMAGE, %WS_EX_LEFT OR %WS_EX_LTRREADING
      CONTROL SET COLOR   hDlg, %IDC_LABEL4, -1, %LTGRAY
      CONTROL ADD BUTTON, hDlg, %IDC_NEXT, "NEXT", 10, 75, 50, 15
      CONTROL ADD BUTTON, hDlg, %IDCANCEL, "QUIT", 10, 95, 50, 15
    #PBFORMS END DIALOG
    
      DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP
    
      FUNCTION = lRslt
    END FUNCTION
    '--------------------------------------------------------------------------------------------------
    Attached Files
    Rod
    I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

  • #2
    Probably more Windows fun than a PB issue. SDK says..
    SS_SIMPLE. Specifies a simple rectangle and displays a single line of left-aligned text in the rectangle. The text line cannot be shortened or altered in any way. Also, if the control is disabled, the control does not gray its text.
    Rgds, Dave

    Comment


    • #3
      That's what I get for just looking in the PB help under CONTROL ADD LABEL where it says
      Code:
      The caption text is left-aligned. If the control is colored, color is only applied to the region containing the caption text, and the remainder of the control is drawn in standard colors.
      I never thought to look at the SDK to see if it were different. Thanks.
      Rod
      I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

      Comment


      • #4
        That is a pretty bad omission in the help file. (under CONTROL ADD LABEL, explanation of SS_SIMPLE style).

        You really should send that in to [email protected] and they will get that info to their documentation writers for revision.. or correct the compiler to behave as documented.

        When the documented behavior does not match the compiler behavior, you just don't know if the error is in the documentation or in the compiler, do you?

        If you want to get geeky about it, checking the SDK is technically useless.. because a control created with "CONTROL ADD LABEL" control is not a standard Windows' control.. it's a PB-proprietary control and therefore its behavior is totally the responsibility of PowerBASIC, Inc.


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

        Comment


        • #5
          Before posting this item I had searched the last three months of the posts to the fora to see if this had come up before, thinking that this might be a PBWin 9.0 thingy. As it turns out, it is something that has been so for a long time, and another search does not reveal any other instances of someone having an issue with it ever.
          So, in an attempt to be geeky, I shall send this in to PB as this dichotomy caused me a loss of time, and for a time, self esteem.

          However, this report may take a while to generate because I want to be sure to send it in in a manner that makes it clear that I am not too simple to use %SS_SIMPLE properly.
          Rod
          I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

          Comment


          • #6
            I want to be sure to send it in in a manner that makes it clear that I am not too simple to use %SS_SIMPLE properly
            Um, you DID use it properly... at least properly as documented.

            When the documented behavior does not equal the actual behavior, that's a bug. It may be a bug in the compiler or it may be a bug in the documentation or it may be a bug in both, but a bug it is.

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

            Comment


            • #7
              This has been sent in. I asked that PBForms be adjusted as well.
              Rod
              I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

              Comment

              Working...
              X