⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fnewform.class

📁 Gambas is a graphical development environment based on a Basic interpreter, like Visual Basic. It us
💻 CLASS
字号:
' Gambas class fileSTATIC PUBLIC Name AS StringSTATIC PUBLIC TemplateClass AS StringSTATIC PUBLIC TemplateForm AS StringSTATIC PUBLIC Startup AS Boolean'STATIC PRIVATE $sType AS StringPRIVATE selExisting AS FSupSelectorSTATIC PUBLIC FUNCTION Run() AS Boolean  DIM hForm AS Form  Name = Project.GetNewName("Form")  hForm = NEW FNewForm  RETURN NOT hForm.ShowModal()ENDPUBLIC SUB _new()  txtFile.Text = Name  txtFile.Select(1, txtFile.Length)  txtFile.SetFocus  tabAdd.Index = 1  selExisting = NEW FSupSelector(tabAdd)  selExisting.DialogType = FSupSelector.SHOW_FILE  'selExisting.Root = "/"  selExisting.ShowRootTab = TRUE  selExisting.ShowHomeTab = TRUE  selExisting.ShowProjectTab = TRUE  'selExisting.TreeSequence = "2"  selExisting.Key = "/ExistingFile"  selExisting.Filters = ("Gambas forms") & "|*.form|" & ("Gambas files") & "|*.form,*.module,*.class|" & ("All files") & "|*"  selExisting.Init()  tabAdd.Index = 0  IF NOT Project.Startup THEN    chkStartup.Value = TRUE  ENDIFENDPUBLIC SUB Form_Resize()  selExisting.Move(8, 8, tabAdd.ClientW - 16, tabAdd.ClientH - 16)ENDPUBLIC SUB btnOK_Click()  IF tabAdd.Index = 0 THEN    Name = Trim(txtFile.Text)    IF Project.CheckClassName(Name, TRUE) THEN      txtFile.SetFocus      RETURN    ENDIF    TemplateClass = "' Gambas class file\n"    TemplateForm = Project.FORM_MAGIC & "\n\n" &      "{ " & Name & " Form\n" &      "  X = 0\n" &      "  Y = 0\n" &      "  Width = 400\n" &      "  Height = 400\n" &      "  Border = Window.Fixed\n"      '"  Text = " & Chr$(34) & Name & Chr$(34) & "\n" &    Startup = chkStartup.Value    IF chkInit.Value THEN      TemplateClass = TemplateClass & "\nSTATIC PUBLIC SUB _init()\n\nEND\n"    ENDIF    IF chkExit.Value THEN      TemplateClass = TemplateClass & "\nSTATIC PUBLIC SUB _exit()\n\nEND\n"    ENDIF    IF chkNew.Value THEN      TemplateClass = TemplateClass & "\nPUBLIC SUB _new()\n\nEND\n"    ENDIF    IF chkFree.Value THEN      TemplateClass = TemplateClass & "\nPUBLIC SUB _free()\n\nEND\n"    ENDIF    IF chkDialog.Value THEN      TemplateClass = TemplateClass &        "\nSTATIC PUBLIC FUNCTION Run() AS Boolean\n\n" &        "  DIM hForm AS Form\n\n" &        "  hForm = NEW " & Name & "\n" &        "  RETURN hForm.ShowModal()\n\n" &        "END\n" &        "\nPUBLIC SUB btnOK_Click()\n\n" &        "  ME.Close(TRUE)\n\n" &        "END\n" &        "\nPUBLIC SUB btnCancel_Click()\n\n" &        "  ME.Close()\n\n" &        "END\n"      TemplateForm = TemplateForm &        "  { btnOK Button\n" &        "    X = 16\n" &        "    Y = 16\n" &        "    Width = 88\n" &        "    Height = 24\n" &        "    Text = " & Chr$(34) & "OK" & Chr$(34) & "\n" &        "    Default = TRUE\n" &        "  }\n" &        "  { btnCancel Button\n" &        "    X = 112\n" &        "    Y = 16\n" &        "    Width = 88\n" &        "    Height = 24\n" &        "    Text = " & Chr$(34) & "Cancel" & Chr$(34) & "\n" &        "    Cancel = TRUE\n" &        "  }\n"    ENDIF    TemplateForm = TemplateForm & "}\n"    ME.Close(TRUE)  ELSE    IF NOT selExisting.Validate() THEN RETURN    TemplateForm = File.Load(selExisting.Path)    TemplateClass = File.Load(File.Dir(selExisting.Path) &/ File.BaseName(selExisting.Path) & ".class")    Name = File.BaseName(selExisting.Path)    ME.Close(TRUE)  ENDIFENDPUBLIC SUB btnCancel_Click()  ME.CloseEND

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -