A Sample GUI Program

This little program displays multiplication tables based on the Button that the user clicks.

Image of Tiny Times Calculator produced by below code.

Here is the complete program BCX source code for Tiny Times Table.

'======================================================================== 
' Tiny Times Table by Kevin Diggins(1999) -- A BCX BASIC sample program 
'======================================================================== 
GUI "TINY_TIMES_TABLE"
'======================================================================== 
MACRO  ID_Button1  = 101
MACRO  ID_Button2  = 102
MACRO  ID_Button3  = 103
MACRO  ID_Button4  = 104
MACRO  ID_Button5  = 105
MACRO  ID_Button6  = 106
MACRO  ID_Button7  = 107
MACRO  ID_Button8  = 108
MACRO  ID_Button9  = 109
MACRO  ID_Button10 = 110
MACRO  ID_Edit     = 200
MACRO  ID_Exit     = 300
'======================================================================== 
DIM    MainMenu   AS HMENU
DIM    FileMenu   AS HMENU
DIM    Form1      AS HWND
DIM    Edit1      AS CONTROL
DIM    Button[10] AS CONTROL
'======================================================================== 

SUB FORMLOAD
  Form1 = BCX_FORM("Tiny Times Table", 0, 0, 120, 170, WS_CAPTION|WS_POPUP)
  Edit1 = BCX_EDIT("", Form1, ID_Edit, 30, 5, 80, 140)

  FOR INTEGER i = 0 TO 9
    Button[i] = BCX_BUTTON(TRIM$(STR$(i + 1)), _
    Form1, 101 + i, 5, 5 + (i * 14), 20, 15)
  NEXT
  '======================================================================== 
  '                          Building Our Menu 
  '======================================================================== 
  MainMenu = CreateMenu() ' CreateMenu returns a MENU HANDLE 
  FileMenu = CreateMenu() ' CreateMenu returns a MENU HANDLE 
  '======================================================================== 
  '                     Build the File Menu First 
  '======================================================================== 
  AppendMenu(FileMenu,MF_STRING , ID_Exit  ,"E&xit")
  '======================================================================== 
  '       Build the Main Menu And Attach the Exit Menu to it and Activate 
  '======================================================================== 
  InsertMenu( MainMenu, ID_Edit, MF_POPUP, FileMenu ,"Exit" )
  SetMenu    ( Form1, MainMenu )
  '======================================================================== 
  CENTER Form1
  SHOW   Form1
END SUB

BEGIN EVENTS
  SELECT CASE CBMSG
    '********************** 
    CASE WM_COMMAND
    '********************** 
    SELECT CASE CBCTL
      CASE ID_Button1 TO ID_Button10
      BuildTable(CBCTL-100)

      CASE ID_Exit
      PostQuitMessage(0)
    END SELECT
  END SELECT
END EVENTS

SUB BuildTable (A)
  LOCAL Buf$
  FOR INTEGER i = 1 TO 20
    Buf$ = Buf$ + "   " + STR$(A) + "  X " + STR$(i) + " = " + STR$(i * A) + CRLF$
  NEXT
  BCX_SET_TEXT(Edit1, Buf$)
END SUB