home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / CODETOOL / VBSCTB.MDB / Librarian.json < prev    next >
Encoding:
JavaScript Object Notation  |  1994-05-04  |  9.6 KB

  1. {
  2.     "schema": {
  3.         "Item": "Text (50)",
  4.         "Declares": "Memo/Hyperlink (255)",
  5.         "Code": "Memo/Hyperlink (255)"
  6.     },
  7.     "data": [
  8.         {
  9.             "Item": "List Box Horizontal Scroll Bar",
  10.             "Declares": "Global Const WM_USER = &H400\r\nGlobal Const LB_SETHORIZONTALEXTENT = (WM_USER + 21)\r\nDeclare Function SendMessage Lib \"User\" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long\r\n\r\n",
  11.             "Code": "' set horizontal scroll bar for list box\r\nDim newwidth%\r\nDim tpp% ' Twips per Pixel\r\n\r\ntpp% = Screen.TwipsPerPixelX\r\nnewwidth% = (TextWidth(longest$ + \"WWWW\") / tpp%)\r\n\r\nlonger& = SendMessage(list1.hWnd, LB_SETHORIZONTALEXTENT, newwidth%, &H0)\r\n\r\n' end of set horizontal scroll bar for list box\r\n"
  12.         },
  13.         {
  14.             "Item": "List Box Tabs",
  15.             "Declares": "Global Const WM_USER = &H400\r\nGlobal Const LB_SETTABSTOPS = (WM_USER + 19)\r\nDeclare Function SendMessage Lib \"User\" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long\r\n\r\n",
  16.             "Code": "' set tab stops in list box - 4 dialog units/character\r\n' therefore, 24/4 = tab at character 6\r\nDim longer&\r\nReDim tabvals%(3)\r\n\r\ntabvals%(0) = 40\r\ntabvals%(1) = 80\r\ntabvals%(2) = 120\r\ntabvals%(3) = 160\r\n\r\nlonger& = SendMessage(list1.hWnd, LB_SETTABSTOPS, 4, tabvals%(0))\r\n\r\n' end of set tab stops"
  17.         },
  18.         {
  19.             "Item": "Common Dialog - File New",
  20.             "Code": "\r\nDim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo File_New_Error\r\n\r\ncd.DialogTitle = \"New File\"\r\ncd.InitDir = app.Path\r\ncd.Filter = \"Text (*.TXT)|*.txt|Documents (*.DOC)|*.doc\"\r\ncd.Flags = OFN_PATHMUSTEXIST Or OFN_HIDEREADONLY Or OFN_CREATEPROMPT\r\ncd.Action = DLG_FILE_OPEN\r\n\r\nmsg$ = \"You selected file \" & cd.Filetitle & Chr$(10) & \" and it's full path is\" & Chr$(10) & cd.Filename & \".\"\r\ntitle$ = \"New File Selected\"\r\nMsgBox msg$, , title$\r\n\r\nExit Sub\r\n\r\nFile_New_Error:\r\nExit Sub\r\n"
  21.         },
  22.         {
  23.             "Item": "Common Dialog - File Open",
  24.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo File_Open_Error\r\n\r\ncd.DialogTitle = \"Open File\"\r\ncd.InitDir = app.Path\r\ncd.Filter = \"Text (*.TXT)|*.txt|Documents (*.DOC)|*.doc\"\r\ncd.Flags = OFN_PATHMUSTEXIST Or OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST\r\ncd.Action = DLG_FILE_OPEN\r\n\r\nmsg$ = \"You selected file \" & cd.Filetitle & Chr$(10) & \" and it's full path is\" & Chr$(10) & cd.Filename & \".\"\r\ntitle$ = \"Open File Selected\"\r\nMsgBox msg$, , title$\r\n\r\nExit Sub\r\n\r\nFile_Open_Error:\r\nExit Sub\r\n\r\n"
  25.         },
  26.         {
  27.             "Item": "Common Dialog - Print",
  28.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo File_Print_Error\r\n\r\ncd.DialogTitle = \"Print File\"\r\ncd.Copies = 1\r\ncd.FromPage = 1\r\ncd.ToPage = 2\r\ncd.Min = 1\r\ncd.Max = 2\r\ncd.Flags = PD_NOSELECTION\r\ncd.Action = DLG_PRINT\r\n\r\nmsg$ = \"You selected from page \" & cd.FromPage & \" to \" & cd.ToPage & \".\"\r\n\r\nIf (cd.Flags And PD_PRINTTOFILE) = PD_PRINTTOFILE Then\r\n  msg$ = msg$ & Chr$(10) & Chr$(10) & \"You selected Print to File.\"\r\nElse\r\n  msg$ = msg$ & Chr$(10) & Chr$(10) & \"You selected Print to Printer.\"\r\nEnd If\r\ntitle$ = \"Print File\"\r\nMsgBox msg$, , title$\r\n\r\nExit Sub\r\n\r\nFile_Print_Error:\r\nExit Sub\r\n\r\n"
  29.         },
  30.         {
  31.             "Item": "Common Dialog - Print Setup",
  32.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo File_PrintSetup_Error\r\n\r\ncd.Flags = PD_PRINTSETUP\r\ncd.Action = DLG_PRINT\r\n\r\nExit Sub\r\n\r\nFile_PrintSetup_Error:\r\nExit Sub\r\n"
  33.         },
  34.         {
  35.             "Item": "Common Dialog - File Save  As",
  36.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo File_Save_Error\r\n\r\ncd.DialogTitle = \"Save File As\"\r\ncd.InitDir = app.Path\r\ncd.DefaultExt = \"TXT\"\r\ncd.Filter = \"Text (*.TXT)|*.txt|Documents (*.DOC)|*.doc\"\r\ncd.Flags = OFN_HIDEREADONLY Or OFN_OVERWRITEPROMPT Or OFN_PATHMUSTEXIST\r\ncd.Action = DLG_FILE_SAVE\r\n\r\nmsg$ = \"You saved file \" & cd.Filetitle & \" as\" & Chr$(10) & cd.Filename & \".\"\r\nIf (cd.Flags And OFN_EXTENTIONDIFFERENT) = OFN_EXTENTIONDIFFERENT Then\r\n  msg$ = msg$ & Chr$(10) & Chr$(10) & \"You selected an invalid Extension.\"\r\nElse\r\n  msg$ = msg$ & Chr$(10) & Chr$(10) & \"You selected a valid Extension.\"\r\nEnd If\r\ntitle$ = \"Save File As\"\r\nMsgBox msg$, , title$\r\n\r\nExit Sub\r\n\r\nFile_Save_Error:\r\nExit Sub\r\n\r\n"
  37.         },
  38.         {
  39.             "Item": "Common Dialog - Fonts",
  40.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo Fonts_Form_Error\r\n\r\ncd.DialogTitle = \"Form Font Selection\"\r\ncd.FontName = Me.FontName\r\ncd.FontSize = Me.FontSize\r\ncd.FontBold = Me.FontBold\r\ncd.FontItalic = Me.FontItalic\r\ncd.Flags = CF_SCREENFONTS Or CF_ANSIONLY Or CF_FORCEFONTEXIST\r\ncd.Action = DLG_FONT\r\n\r\nMe.FontName = cd.FontName\r\nMe.FontSize = cd.FontSize\r\nMe.FontBold = cd.FontBold\r\nMe.FontItalic = cd.FontItalic\r\nMe.Refresh\r\n\r\nCall Form_Paint\r\n\r\nExit Sub\r\n\r\nFonts_Form_Error:\r\nExit Sub\r\n"
  41.         },
  42.         {
  43.             "Item": "Common Dialog - Color",
  44.             "Code": "Dim cd As Control\r\n\r\nSet cd = Me.CMDialog1\r\n\r\n'set cancel to true\r\ncd.CancelError = True\r\n\r\nOn Error GoTo Form_BC_Error\r\n\r\ncd.DialogTitle = \"Form Back Color Selection\"\r\ncd.Color = Me.BackColor\r\ncd.Flags = CC_RGBINIT\r\ncd.Action = DLG_COLOR\r\n\r\nMe.BackColor = cd.Color\r\nMe.Refresh\r\n\r\nExit Sub\r\n\r\nForm_BC_Error:\r\nExit Sub\r\n"
  45.         },
  46.         {
  47.             "Item": "Text Box - Uppercase Only",
  48.             "Code": "  If keyascii = 13 Then\r\n    \r\n    ' this line keeps the keyboard from beeping\r\n    keyascii = 0\r\n\r\n    ' this line cases the cursor to move to the next field\r\n    SendKeys \"{TAB}\"\r\n\r\n  Else\r\n    \r\n    ' to convert all entered data to uppercase we do the following\r\n    ' 1. convert the ascii code to a character - Chr$(Keyascii)\r\n    ' 2. convert the character to uppercase Ucase(Chr$(keyascii))\r\n    ' 3. convert the uppcase Character back to ascii Asc(Ucase(Chr$(keyascii)))\r\n    keyascii = Asc(UCase(Chr$(keyascii)))\r\n\r\n  End If\r\n"
  49.         },
  50.         {
  51.             "Item": "Text Box - Numbers Only",
  52.             "Code": "  ' this routine allows the processing of numbers only\r\n  If keyascii = 13 Then\r\n    keyascii = 0\r\n    SendKeys \"{TAB}\"\r\n  Else\r\n    If keyascii >= 48 And keyascii <= 57 Then\r\n      ' okay accept the number\r\n    ElseIf keyascii = 8 Then\r\n      ' let the backSpace key work\r\n    Else\r\n      ' not a number so lose the keystroke\r\n      keyascii = 0\r\n    End If\r\n  End If\r\n"
  53.         },
  54.         {
  55.             "Item": "Form - Center",
  56.             "Code": "' center form\r\nLeft = (Screen.Width - Width) / 2   ' Center form horizontally.\r\nTop = (Screen.Height - Height) / 2  ' Center form vertically.\r\n"
  57.         },
  58.         {
  59.             "Item": "Menu - Right Justify Item",
  60.             "Code": "MNU_About.Caption = Chr$(8) + \"Help\""
  61.         },
  62.         {
  63.             "Item": "Outline - Database Loading",
  64.             "Code": "tb1.MoveFirst\r\n\r\nIf tb1.EOF = False Then\r\n    Do While tb1.EOF = False\r\n'    Debug.Print tb1(\"Category\"), tb1(\"Project\"), tb1(\"File\"), tb1(\"Extension\")\r\n        If Trim$(tb1(\"Category\")) = save_Category$ Then\r\n            If Trim$(tb1(\"Project\")) = save_Project$ Then\r\n                item$ = Space(100)\r\n                Mid$(item$, 1, 8) = tb1(\"File\")\r\n                Mid$(item$, 10, 3) = tb1(\"Extension\")\r\n                Mid$(item$, 14, 50) = tb1(\"description\")\r\n                Outline1.AddItem item$\r\n                Outline1.Indent(Outline1.ListCount - 1) = 3\r\n                save_File$ = tb1(\"File\")\r\n            Else\r\n                item$ = tb1(\"Project\")\r\n                Outline1.AddItem item$\r\n                Outline1.Indent(Outline1.ListCount - 1) = 2\r\n                save_Project$ = tb1(\"Project\")\r\n                \r\n                item$ = Space(100)\r\n                Mid$(item$, 1, 8) = tb1(\"File\")\r\n                Mid$(item$, 10, 3) = tb1(\"Extension\")\r\n                Mid$(item$, 14, 50) = tb1(\"description\")\r\n'                item$ = tb1(\"File\")\r\n                Outline1.AddItem item$\r\n                Outline1.Indent(Outline1.ListCount - 1) = 3\r\n                save_File$ = tb1(\"File\")\r\n            End If\r\n        Else\r\n            item$ = tb1(\"Category\")\r\n            Outline1.AddItem item$\r\n            Outline1.Indent(Outline1.ListCount - 1) = 1\r\n            save_Category$ = tb1(\"Category\")\r\n            \r\n            item$ = tb1(\"Project\")\r\n            Outline1.AddItem item$\r\n            Outline1.Indent(Outline1.ListCount - 1) = 2\r\n            save_Project$ = tb1(\"Project\")\r\n\r\n            item$ = Space(100)\r\n            Mid$(item$, 1, 8) = tb1(\"File\")\r\n            Mid$(item$, 10, 3) = tb1(\"Extension\")\r\n            Mid$(item$, 14, 50) = tb1(\"description\")\r\n'            item$ = tb1(\"File\")\r\n            Outline1.AddItem item$\r\n            Outline1.Indent(Outline1.ListCount - 1) = 3\r\n            save_File$ = tb1(\"File\")\r\n            \r\n        End If\r\n    tb1.MoveNext\r\n    Loop\r\nElse\r\nEnd If\r\n\r\nLoad_Outline_Exit:\r\n"
  65.         },
  66.         {
  67.             "Item": "AddNew Record to Database",
  68.             "Code": "key$ = TXT_Item\r\n\r\ntb.Seek \"=\", key$\r\nIf tb.NoMatch = True Then\r\n  ' record doesn't exist so let's proceed\r\n  tb.AddNew\r\n    tb(\"Item\") = key$\r\n    tb(\"Declares\") = TXT_Declares\r\n    tb(\"Code\") = TXT_Code\r\n  tb.Update\r\nElse\r\n  ' duplicate record\r\n  msg$ = \"An item with the same description was found.\" & Chr$(10) & \"Please enter a new item description\"\r\n  title$ = \"Duplicate Item\"\r\n  MsgBox msg$, , title$\r\n  Exit Sub\r\nEnd If\r\n"
  69.         }
  70.     ]
  71. }