Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

PBForms Creating All Dialogs with %HWND_DESKTOP

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

  • PBForms Creating All Dialogs with %HWND_DESKTOP

    This is reference to the following post:

    http://www.powerbasic.com/support/pb...304#post273304

    Sample with a main dialog and two additional dialogs. Notice under PBMain that each dialog ends w/%HWND_DESKTOP. The below code copied unmodified from the IDE.

    #PBFORMS CREATED V1.51
    #COMPILE EXE
    #DIM ALL

    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
    #INCLUDE "WIN32API.INC"
    #ENDIF
    #PBFORMS END INCLUDES

    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1 = 101
    %IDD_DIALOG2 = 102
    %IDD_DIALOG3 = 103
    #PBFORMS END CONSTANTS

    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE CALLBACK FUNCTION ShowDIALOG2Proc()
    DECLARE CALLBACK FUNCTION ShowDIALOG3Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    DECLARE FUNCTION ShowDIALOG2(BYVAL hParent AS DWORD) AS LONG
    DECLARE FUNCTION ShowDIALOG3(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS

    FUNCTION PBMAIN()
    ShowDIALOG1 %HWND_DESKTOP
    ShowDIALOG2 %HWND_DESKTOP
    ShowDIALOG3 %HWND_DESKTOP
    END FUNCTION

    CALLBACK FUNCTION ShowDIALOG1Proc()

    SELECT CASE AS LONG CBMSG
    CASE %WM_INITDIALOG

    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CBWPARAM THEN
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF

    CASE %WM_COMMAND
    SELECT CASE AS LONG CBCTL

    END SELECT
    END SELECT
    END FUNCTION

    CALLBACK FUNCTION ShowDIALOG2Proc()

    SELECT CASE AS LONG CBMSG
    CASE %WM_INITDIALOG

    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CBWPARAM THEN
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF

    CASE %WM_COMMAND
    SELECT CASE AS LONG CBCTL

    END SELECT
    END SELECT
    END FUNCTION

    CALLBACK FUNCTION ShowDIALOG3Proc()

    SELECT CASE AS LONG CBMSG
    CASE %WM_INITDIALOG

    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CBWPARAM THEN
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF

    CASE %WM_COMMAND
    SELECT CASE AS LONG CBCTL

    END SELECT
    END SELECT
    END FUNCTION

    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG

    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
    LOCAL hDlg AS DWORD

    DIALOG NEW hParent, "Parent Dialog", 70, 70, 267, 164, %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR _
    %WS_SYSMENU OR %WS_CLIPSIBLINGS 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
    #PBFORMS END DIALOG

    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt

    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP

    FUNCTION = lRslt
    END FUNCTION

    FUNCTION ShowDIALOG2(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG

    #PBFORMS BEGIN DIALOG %IDD_DIALOG2->->
    LOCAL hDlg AS DWORD

    DIALOG NEW hParent, "Dialog2", 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_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_WINDOWEDGE OR _
    %WS_EX_CONTROLPARENT OR %WS_EX_CONTEXTHELP OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR, TO hDlg
    #PBFORMS END DIALOG

    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG2Proc TO lRslt

    #PBFORMS BEGIN CLEANUP %IDD_DIALOG2
    #PBFORMS END CLEANUP

    FUNCTION = lRslt
    END FUNCTION

    FUNCTION ShowDIALOG3(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG

    #PBFORMS BEGIN DIALOG %IDD_DIALOG3->->
    LOCAL hDlg AS DWORD

    DIALOG NEW hParent, "Dialog3", 70, 70, 201, 121, %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR _
    %WS_SYSMENU OR %WS_CLIPSIBLINGS 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
    #PBFORMS END DIALOG

    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG3Proc TO lRslt

    #PBFORMS BEGIN CLEANUP %IDD_DIALOG3
    #PBFORMS END CLEANUP

    FUNCTION = lRslt
    END FUNCTION
    sigpicMark Pruitt
    [email protected]

    http://ezreregister.com
    Manage 3rd party BlackBerry software registration codes.

    It's not the only way to do it...just the EZ way!

  • #2
    Mark,

    Suppose you could post this with code tags? It sure makes it easier to read and easier to copy/paste.
    Software makes Hardware Happen

    Comment


    • #3
      Notice under PBMain that each dialog ends w/%HWND_DESKTOP. The below code copied unmodified from the IDE.
      And?

      I am not a PB/Forms user, but I very much doubt the generated source code file is created 'Read-only.'


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

      Comment

      Working...
      X