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

📄 fnewtext.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 Template AS StringSTATIC PUBLIC DestDir AS StringPRIVATE selExisting AS FSupSelectorPRIVATE selDest AS FSupSelectorSTATIC PUBLIC FUNCTION Run(sDestDir AS String) AS Boolean  DIM hForm AS Form  DestDir = sDestDir  hForm = NEW FNewText  RETURN NOT hForm.ShowModal()ENDPUBLIC SUB _new()  'ME.Title = "New " & $sType  'txtFile.Text = Name  txtFile.SetFocus  tabAdd.Index = 1  selExisting = NEW FSupSelector(tabAdd)  selExisting.DialogType = FSupSelector.SHOW_FILE  'selExisting.Root = "/"  selExisting.ShowHomeTab = TRUE  selExisting.ShowRootTab = TRUE  selExisting.ShowProjectTab = TRUE  selExisting.Key = "/ExistingText"  selExisting.Filters = ("Text files") & "|*.txt,*.text,*.html|" & ("All files") & "|*"  selExisting.Init()  tabAdd.Index = 0  selDest = NEW FSupSelector(tabAdd)  WITH selDest    .DialogType = FSupSelector.Show_DIRECTORY    .Root = File.Dir(Project.Path)    .ShowProjectTab = TRUE    .DoNotShowCustomTabs = TRUE    .Path = If(DestDir, DestDir, selDest.Root)    .Init()    .Move(lblDest.X, lblDest.Y, lblDest.W, lblDest.H)  END WITHENDPUBLIC SUB Form_Resize()  selExisting.Move(8, 8, tabAdd.ClientW - 16, tabAdd.ClientH - 16)ENDPUBLIC SUB btnOK_Click()  DIM sPath AS String  DIM hPict AS Picture  IF tabAdd.Index = 0 THEN    Name = Trim(txtFile.Text)    Template = ""    IF NOT selDest.Validate() THEN RETURN    DestDir = selDest.Path    IF Project.CheckFileName(Name, DestDir) THEN      txtFile.SetFocus      RETURN    ENDIF    sPath = DestDir &/ Name    File.Save(sPath, "")  ELSE    IF NOT selExisting.Validate() THEN RETURN    sPath = selExisting.Path    Template = sPath    Name = File.Name(sPath)  ENDIF  ME.Close(TRUE)ENDPUBLIC SUB btnCancel_Click()  ME.CloseEND

⌨️ 快捷键说明

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