Announcement

Collapse
No announcement yet.

%TABSTOP Failure, Get The Ding Instead

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

  • colin glenn
    replied
    Originally posted by Michael Mattias View Post
    If an DDT dialog do you have a message loop if you did the DIALOG SHOW with the MODELESS option?
    My bad, it's me, I will need to process the tab key myself via the main message loop:
    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
    %USEMACROS = 1
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
    #ENDIF
    #IF NOT %DEF(%COMMCTRL_INC)
        #INCLUDE "COMMCTRL.INC"
    #ENDIF
    #INCLUDE "PBForms.INC"
    #PBFORMS END INCLUDES
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Constants **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN CONSTANTS
    %IDC_POSITIONX   = 1001
    %IDC_POSITIONY   = 1003
    %IDD_MAINWINDOW  =  102
    %IDD_TESTTABBING =  101
    %IDT_POSITIONX   = 1004
    %IDT_POSITIONY   = 1005
    #PBFORMS END CONSTANTS
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowChildDialogProc()
    DECLARE FUNCTION ShowChildDialog(BYVAL hParent AS DWORD) AS LONG
    DECLARE CALLBACK FUNCTION ShowMainWindowProc()
    DECLARE FUNCTION ShowMainWindow(BYVAL hDlg AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
        PBFormsInitComCtls (%ICC_WIN95_CLASSES OR %ICC_DATE_CLASSES OR _
            %ICC_INTERNET_CLASSES)
    
        ShowMainWindow %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowChildDialogProc()
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                ' Initialization handler
                CONTROL SET TEXT CB.HNDL, %IDT_POSITIONX, "10"
                CONTROL SET TEXT CB.HNDL, %IDT_POSITIONY, "-5"
    
            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
    
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowChildDialog(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_TESTTABBING->->
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW PIXELS, hParent, "Test Tabbing", 0, 0, 256, 182, _
            %WS_CHILD OR %WS_CLIPCHILDREN OR %WS_VISIBLE _
            OR %DS_NOFAILCREATE OR %DS_SETFONT, _
            %WS_EX_STATICEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING, TO hDlg
        CONTROL ADD "msctls_updown32", hDlg, %IDC_POSITIONX, "PositionX", 78, 52, _
            14, 20, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %UDS_SETBUDDYINT
        CONTROL ADD "msctls_updown32", hDlg, %IDC_POSITIONY, "PositionY", 78, 78, _
            14, 20, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %UDS_SETBUDDYINT
        CONTROL ADD TEXTBOX, hDlg, %IDT_POSITIONX, "PositionX", 24, 52, 54, 20
        CONTROL ADD TEXTBOX, hDlg, %IDT_POSITIONY, "PositionY", 24, 78, 54, 20
    #PBFORMS END DIALOG
    
        LOCAL hTextBox, hUpDown     AS DWORD
        CONTROL HANDLE hDlg, %IDC_POSITIONX TO hUpDown
        CONTROL HANDLE hDlg, %IDT_POSITIONX TO hTextBox
        CONTROL SEND hDlg, %IDC_POSITIONX, %UDM_SETBUDDY, hTextBox, 0
        CONTROL SEND hDlg, %IDC_POSITIONX, %UDM_SETRANGE32, -255, 255
    
        CONTROL HANDLE hDlg, %IDC_POSITIONY TO hUpDown
        CONTROL HANDLE hDlg, %IDT_POSITIONY TO hTextBox
        CONTROL SEND hDlg, %IDC_POSITIONY, %UDM_SETBUDDY, hTextBox, 0
        CONTROL SEND hDlg, %IDC_POSITIONY, %UDM_SETRANGE32, -255, 255
    
    #PBFORMS BEGIN CLEANUP %IDD_TESTTABBING
    #PBFORMS END CLEANUP
    
        FUNCTION = hDlg
    END FUNCTION
    '------------------------------------------------------------------------------
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowMainWindowProc()
    
    STATIC hChild AS DWORD
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                ' Initialization handler
                hChild = ShowChildDialog(CB.HNDL)
                DIALOG SHOW MODELESS hChild, CALL ShowChildDialogProc
    
            CASE %WM_SIZE
                LOCAL FormX, FormY AS LONG
                DIALOG GET CLIENT CB.HNDL TO FormX, FormY
                CONTROL SET LOC CB.HNDL, %IDT_POSITIONX, 0, 0
                CONTROL SET LOC CB.HNDL, %IDT_POSITIONY, 100, 0
                DIALOG SET LOC hchild, 0, 25
    
            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_DESTROY
                PostQuitMessage 0
    
            CASE %WM_COMMAND
                ' Process control notifications
                SELECT CASE AS LONG CBCTL
    
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    FUNCTION ShowMainWindow(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_MAINWINDOW->->
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW PIXELS, hParent, "Main Window", %CW_USEDEFAULT, %CW_USEDEFAULT, 300, 350, %WS_POPUP OR _
            %WS_BORDER OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
            %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX 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 hDlg
        CONTROL ADD TEXTBOX, hDlg, %IDT_POSITIONX, "PositionX", 24, 52, 54, 20
        CONTROL ADD TEXTBOX, hDlg, %IDT_POSITIONY, "PositionY", 24, 78, 54, 20
    #PBFORMS END DIALOG
    The culprit:
    Code:
        DIALOG SHOW MODELESS hDlg, CALL ShowMainWindowProc TO lRslt
    
        LOCAL Msg           AS TAGMSG
        WHILE GetMessage(Msg, BYVAL %NULL, 0, 0) > 0
            TranslateMessage Msg
            DispatchMessage Msg
        WEND
    
    #PBFORMS BEGIN CLEANUP %IDD_MAINWINDOW
    #PBFORMS END CLEANUP
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------

    Leave a comment:


  • Rodney Hicks
    replied
    You may also find the solution to the issue if you deliberately try to create a small app that has those features for display purposes.

    Leave a comment:


  • Michael Mattias
    replied
    Did you subclass any controls?

    That's a pretty easy way to screw up the operation of system keys such as <Tab>

    Do you ever change the Zorder on the fly? Do you change control styles after creation? Have you changed any control styles at all from the last time "it worked?"

    Is this a dialog created with CreateDialog() or DialogBox, or a window you have created with CreateWindowEx? If an DDT dialog do you have a message loop if you did the DIALOG SHOW with the MODELESS option?

    Are you using any synchonization object with the WaitForxxx functions?

    These are all some places where tab navigation can disabled or interfered with by not coding correctly.

    A compilable and runnable (ie, no missing DLLs or data files) example demonstrating problem will be required, unless of course you wish to engage an outside consulant.

    MCM

    Leave a comment:


  • colin glenn
    replied
    Which would be a good starting point, however, dumping the whole project up is currently not an option, so the question is, where to start in constructing or posting code to see what I've managed to do to make tabbing quit.

    Leave a comment:


  • Rodney Hicks
    replied
    Perhaps showing us compilable code that displays this issue help might then arrive quicker. We can only guess without the code.

    Leave a comment:


  • colin glenn
    started a topic %TABSTOP Failure, Get The Ding Instead

    %TABSTOP Failure, Get The Ding Instead

    I'm getting Ding's (default windows sound) when pressing the Tab key while in a child Textbox. Plus, generally, I don't seem to be getting tab navigation in my application. Specifically, I am using a child dialog in the main dialog to group a bunch of controls and tabbing does not do anything, or I get a "Ding!" if I'm in a textbox. Where should I start looking for the problem?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎