📄 fnewclass.class
字号:
' Gambas class fileSTATIC PUBLIC Name AS StringSTATIC PUBLIC Template AS StringSTATIC PUBLIC Startup AS Boolean'STATIC PRIVATE $sType AS StringPRIVATE selExisting AS FSupSelectorSTATIC PUBLIC FUNCTION Run() AS Boolean DIM hForm AS FNewClass Name = Project.GetNewName("Class") hForm = NEW FNewClass RETURN NOT hForm.ShowModal()ENDPUBLIC SUB _new() 'ME.Title = "New " & $sType txtFile.Text = Name txtFile.Selection(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 classes") & "|*.class|" & ("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 Template = "' Gambas class file\n" IF chkStartup.Value THEN Template = Template & "\nSTATIC PUBLIC SUB Main()\n\nEND\n" Startup = TRUE ELSE Startup = FALSE ENDIF IF chkInit.Value THEN Template = Template & "\nSTATIC PUBLIC SUB _init()\n\nEND\n" ENDIF IF chkExit.Value THEN Template = Template & "\nSTATIC PUBLIC SUB _exit()\n\nEND\n" ENDIF IF chkNew.Value THEN Template = Template & "\nPUBLIC SUB _new()\n\nEND\n" ENDIF IF chkFree.Value THEN Template = Template & "\nPUBLIC SUB _free()\n\nEND\n" ENDIF ME.Close(TRUE) ELSE IF NOT selExisting.Validate() THEN RETURN Template = File.Load(selExisting.Path) Name = File.BaseName(selExisting.Path) ME.Close(TRUE) ENDIFENDPUBLIC SUB btnCancel_Click() ME.CloseEND
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -