Announcement

Collapse
No announcement yet.

PBWin 9.01 Tab Problem

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

  • PBWin 9.01 Tab Problem

    I'm having a problem with the Tab Control - it seems that they have a problem with Option controls outside the Tab. Below is a short example showing the problem ... the comments explain what's going on. I've tried this with both XP and Vista.

    Code:
    #INCLUDE "win32api.inc"
    
    FUNCTION PBMAIN () AS LONG
    
      LOCAL hDlg AS LONG
      LOCAL Tab1 AS LONG
    
      ' Create the Main Dialog
      DIALOG NEW 0, "Tab Test",,, 200, 150, %WS_SYSMENU TO hDlg
    
      ' Add a couple of options
      ' These seem to fail if a single control is added to the Tab below
      ' They do not fail for other types of control here
      CONTROL ADD FRAME, hDlg, -1, "", 10, 9, 90, 40
      CONTROL ADD OPTION, hDlg, 1001, "Option 1", 20, 18, 70, 12
      CONTROL ADD OPTION, hDlg, 1002, "Option 2", 20, 32, 70, 12
    
      ' Add a Tab control
      CONTROL ADD TAB, hDlg, 1003, "", 10, 60, 175, 60
    
      ' Add Tab page
      TAB INSERT PAGE hDlg, 1003, 1, 0, "   Tab 1   " TO Tab1
    
      ' Add a Control to the Tab
      ' The following line causes the Option controls above to fail
      ' It does not seem to matter which type of control is added here
      ' If no control is added to Tab1 then the above Options are OK
      CONTROL ADD LABEL, Tab1, -1, "Hello", 10, 10, 250, 12
    
      ' Display the main dialog box
      DIALOG SHOW MODAL hDlg
    
    END FUNCTION

  • #2
    James,

    Yes, I can confirm this too. Might be related to the message pump reacting strangely.
    So here we are, this is the end.
    But all that dies, is born again.
    - From The Ashes (In This Moment)

    Comment


    • #3
      The OPTION controls are being created with the default styles. The first control in the group should have the WS_GROUP and WS_TABSTOP style , the rest not. This might be messing up something else on this screen.


      >Might be related to the message pump reacting strangely.

      As written code uses the default message loop provided for modal dialogs, so that is unlikely.

      However, no callback function is defined for anything, so there is not much for the message loop to do anyway.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Michael nailed it!

        Code:
        #INCLUDE "win32api.inc"
        
        FUNCTION PBMAIN () AS LONG
        
          LOCAL hDlg AS LONG
          LOCAL Tab1 AS LONG
          LOCAL nStyle AS LONG
        
          ' Create the Main Dialog
          DIALOG NEW 0, "Tab Test",,, 200, 150, %WS_SYSMENU TO hDlg
        
          ' Add a couple of options
          ' These seem to fail if a single control is added to the Tab below
          ' They do not fail for other types of control here
          nStyle = %WS_TABSTOP OR %WS_GROUP                  '<----------------------- add this
          CONTROL ADD FRAME, hDlg, -1, "", 10, 9, 90, 40
          CONTROL ADD OPTION, hDlg, 1001, "Option 1", 20, 18, 70, 12, nStyle
          CONTROL ADD OPTION, hDlg, 1002, "Option 2", 20, 32, 70, 12
        
          ' Add a Tab control
          nStyle = %WS_CHILD AND %WS_TABSTOP OR %WS_GROUP    '<----------------------- add this
          CONTROL ADD TAB, hDlg, 1003, "", 10, 60, 175, 60, nStyle
        
          ' Add Tab page
          TAB INSERT PAGE hDlg, 1003, 1, 0, "   Tab 1   " TO Tab1
        
          ' Add a Control to the Tab
          ' The following line causes the Option controls above to fail
          ' It does not seem to matter which type of control is added here
          ' If no control is added to Tab1 then the above Options are OK
          CONTROL ADD LABEL, Tab1, -1, "Hello", 10, 10, 250, 12
        
          ' Display the main dialog box
          DIALOG SHOW MODAL hDlg CALL dlgProc
        END FUNCTION
        
        CALLBACK FUNCTION dlgProc()
           SELECT CASE CB.MSG
              CASE %WM_INITDIALOG
                 CONTROL SET OPTION CB.HNDL, 1001, 1001, 1002
           END SELECT
        END FUNCTION

        Comment

        Working...
        X