Announcement

Collapse
No announcement yet.

Bar Menu not showing

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

  • Bar Menu not showing

    Can anyone spot why the bar menu is not showing? I haven't been able to {sigh}.

    '
    Code:
    'PBWIN 9.00 - WinApi 05/2008 - XP Pro SP3
    #Dim All 
    #Compile Exe  
    #Include "WIN32API.INC"
    '
    Global hdlg As Dword                
    %Id_Exit_Btn = 1000
    %Id_Sample_Textbox = 1001
    %Id_Show_Result_Btn = 1002
    '
    '
    Sub Bar_Menus_Setup 
        common_Locals
    End Sub           
    ' 
    Macro Common_Locals 'Macro easier than retyping and maintains coding consistency
      Global Dlg_hght, Dlg_Wd As Long 'Global in case want to use in Controls
      Local Row, col, hght, wd, Longest,ctr, ln, ln1, i As Long
      Local  l, s As String
    End Macro  
    '
    CallBack Function Dialog_Processor              
      Common_Locals
      Select Case CbMsg     'This is TO determine the message TYPE 
         '       
         Case %WM_INITDIALOG'<- Initialiaton when the program loads 
         '
         Case %WM_SYSCOMMAND 'Traps Any Alt key but only F4 closes              
         '
         Case %WM_COMMAND  'This processes command messages
           Select Case CbCtl
             Case %Id_Show_Result_Btn 
                Control Get Text CbHndl, %Id_Sample_Textbox To l$
                  ? l$, , FuncName$
             Case %Id_Exit_Btn
               Select Case CbCtlMsg        
                  Case 0
                    Dialog End CbHndl 'Applikation beenden
               End Select
           End Select
      End Select
    End Function
    '
    Function PBMain
      Common_Locals
      Dlg_hght = 400
      Dlg_Wd = 400
      Dialog New Pixels, hdlg, "Demo", , , Dlg_Wd, Dlg_Hght, %WS_SYSMENU To hdlg 'centered
    '
      
    '  Call Bar_Menus_Setup
    '**************************
        Local hMenu, pu As Dword
        Local hPopup1, hPopup2, hPopup3, hPopup4, hPopup5 As Dword
        Local hPopup6, hPopup7, hPopup8, hPopup9, hPopup10 As Dword
        Local u$
        u$ = Space$(40)
          ' ** First create a top-level menu:
      Menu New Bar To hMenu
      ' ** Add a top-level menu item with a popup menu:
      RSet u$ = "&F  File Stuff"
      Menu New PopUp To hPopup1 'assign a popup value 
        pu = hPopup1 'easier to C&P when adding menus
        Menu Add PopUp,  hMenu, u$, hPopup1, %MF_ENABLED 'assign to popup handle
          Menu Add String, pu, "Header",      0, 0 'SubMenu header
          For ctr = 1 To 10
               Menu Add String, pu, Str$(ctr) & " test", 2000 + ctr, %MF_ENABLED
          Next ctr
          Menu Add String, pu, "-",      0, 0 'bar
          Menu Add String, pu, "&X  Exit", 999, %MF_ENABLED
          Menu Add String, pu, "-",      0, 0 'bottom bar
    '**************************
      Row = 10
      col = 10
      Wd = 40
      Hght = 12
      Control Add Label, hdlg, -1, " Name & Address ", Col, Row, Wd, Hght
      
      s$ = "Brown, Kevin" & $CrLf & _
           "123 PBWin Avenue" & $CrLf & _
           "PowerBasic, FL 12345"
             
      Col = Col + Wd + 10 'just past label 
      Hght = 15 * 10 'Plenty room for 10 lines of text
      Wd = Dlg_Wd - 40 - 30 'minus the label and leave a little
      Control Add TextBox, hdlg, %Id_Sample_Textbox, s$, Col, Row, Wd, Hght, %ES_WantReturn Or %ES_MultiLine
       hght = 25   
       Wd = Dlg_Wd - 20
       Col = 10 'center
       Row = Dlg_hght - (Hght * 2) - 4 'Just off bottom
         Control Add Button, hdlg, %Id_Show_Result_Btn, "Show Textbox Results", col, row, Wd, Hght
       Row = Dlg_hght - Hght - 2 'Just off bottom
         Control Add Button, hdlg, %Id_Exit_Btn, "Abandon Ship", col, row, Wd, Hght
      
         Dialog Show Modal hDlg   Call Dialog_Processor
    End Function  'Applikation beenden
    '
    =======================================
    "Logic is in the eye of the logician."
    Gloria Steinem
    =======================================
    It's a pretty day. I hope you enjoy it.

    Gösta

    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

  • #2
    Menu Attach

    Hi Gösta,

    You need to:

    Code:
    MENU ATTACH hMenu, hDlg
    after you create the menu.

    Regards,

    Pete.

    Comment


    • #3
      Thanks Pete. I was C&P'ing from an older program and missed that.

      =================================
      The first half of our lives
      is ruined by our parents,
      the second half by our children.
      Clarence Darrow (1857-1938)
      =================================
      It's a pretty day. I hope you enjoy it.

      Gösta

      JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
      LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

      Comment

      Working...
      X