Notepad με χρωματισμό εντολών VB6 (με αγγλικές εντολές)

Πήγαινε κάτω

Notepad με χρωματισμό εντολών VB6 (με αγγλικές εντολές)

Δημοσίευση από m2000 Την / Το Δευ Ιουν 13, 2016 1:29 pm

Γράψτε το παρακάτω ως notepad.gsb και τρέξτε το (και με διπλό κλικ αφού ενημερώσετε το σύστημα ότι θα ξεκινάει με το m2000.exe)
Ένας τρόπος: ανοίγουμε το m2000.exe γράφουμε Σ "notepad.exe" και κάνουμε επικόλληση το παρακάτω, μετά με Load notepad τρέχει ή αν θέλουμε ανοίγουμε το φάκελο Win Dir$ που γράφει για το χρήστη η Μ2000 τα αρχεία και το αντιγράφουμε στο desktop και το τρέχουμε από εκεί.
(η Μ2000 ανοίγει τα gsb αρχεία είτε είναι UTF-8 είτε ANSI)
(η γραμμή με τις εντολές της Visual Basic δεν φαίνεται όλη εδώ αλλά υπάρχει. Με αντιγραφή την δίνει όλη όπως είναι)

MODULE A {\\ notepad
Clear \\ Clear all variables/objects
Flush \\ Empty the stack
title$="M2000 Pad"
Dir User
Declare NotePad Form
Declare Pad EditBox Form NotePad
Declare Inform1 Button Form NotePad
Method Inform1, "Colors", 15, #FFA000
With Inform1, "Locked", true
Declare File1 Combobox Form NotePad
Declare Edit1 Combobox Form NotePad
Declare Help1 Combobox Form NotePad
With File1,"label","File", "listtext" As list$, "list" As list$() '
With Edit1,"label","Edit",  "Mark", Color(255,100,0)
With Help1,"label","Help",  "Mark", Color(255,100,0)
With NotePad, "Title" As Caption$, "Visible" As Visible, "TitleHeight" As tHeight, "Sizable", True
With Pad, "Text" As Pad.text$, "ShowAlways", True,"NoColor", True,"SelLength" as SelLength
Def TitleStr$(a$)=Ucase$(Left$(a$,1))+Mid$(a$,2)
Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
Title caption$
Method NotePad,"move", 2000, 4000, 8000, 4000
Layer NotePad {Cls #FFA000}
With File1,"MenuStyle", True, "MenuWidth", 3000
With Edit1,"MenuStyle", True, "MenuWidth", 3000,"menuEnabled" as Enabled()
With Help1,"MenuStyle", True, "MenuWidth", 3000
With File1, "MenuEnabled" As mEnable()
For This {
      mi$="MenuItem"  \\ is a temporary variable only for For This Block
      With File1, "MenuGroup","This"
      Method File1, mi$,"Open",True
      Method File1, mi$,"Save",True
      Method File1, mi$,""    \\  only  a line here
      Method File1,"MenuRadio","txt files",True,True
      Method File1,"MenuRadio","bas files",True,False
      Method File1, mi$,""
      Method File1, mi$,"Close",True
      Method File1, mi$,""
      Method File1, mi$,"Quit",True
      With Edit1, "MenuGroup","This"
      Method Edit1, mi$,"Cut",False
      Method Edit1, mi$,"Copy",False
      Method Edit1, mi$,"Paste",True
      Method Edit1, mi$,""
      Method Edit1, mi$,"Less Indent",True
      Method Edit1, mi$,"More Indent",True
      With Help1, "MenuGroup","This"

Document BackUp$="Write something..."
Function NotePad.Unload {
      Read New &Ok
      After 30 {call local File1.DblClick(8) }

Function Notepad.Resize {
      Layer NotePad { Cls Color(255, 160, 0) ,0}
      With NotePad, "Width" As NP.Width, "Height" As NP.Height, "TitleHeight" As tHeight
      Method File1,"move", twipsX*2, tHeight, twipsX*80, tHeight
      Method Edit1,"move", twipsX*2+twipsX*80, tHeight, twipsX*80, tHeight
      Method Help1,"move", twipsX*2+twipsX*160, tHeight, twipsX*80, tHeight
      Method Inform1,"move", twipsX*2+twipsX*240, tHeight, twipsX*160, tHeight
      If NP.height>1000 Then {
            Method Pad,"move", twipsX*2, tHeight1, NP.Width-twipsX*5, NP.Height-tHeight1-twipsx*3
            With Pad, "NoWrap" As NoWrap
            If Not NoWrap Then Method Pad,"Resize"
Function Edit1.OpenMenu {
            Local X

Function Edit1.DblClick {
      Read Local Edit1index
      Select Case Edit1index
      Case 0
            Method Pad,"mn1sub"
            Method Pad,"Resize"
      Case 1
            Method Pad,"mn2sub"
      Case 2
                 Method Pad, "mn3sub"
                 Method Pad,"GetFocus"
                 Method Pad,"Resize"
        Case 4
                  Method Pad,"PressKey", 9, 1
        Case 5
                  Method Pad,"PressKey", 9, 0
      End Select

Function Pad.Inform {
      Read New L, P
      With Inform1, "Caption", format$("{0}-{1}", L,P)
      Method Pad,"Show"
Function Pad.PopUp {
      Read Local X, Y
      Method Pad,"PopUpMenu", "",X , Y
Function File1.MenuChecked {
Read New RadioIndex \\ 3 or 4
If RadioIndex =3 Then {
      After 30 { Static a$="."+File.type$(Filename$), b$$(Filename$)
      Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
      With Pad, "ColorCollection1", "","NoColor", True
      Method Pad, "Show"
} Else.If RadioIndex =4 Then {
     After 30 { Static a$="."+File.type$(Filename$), b$$(Filename$)
      Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
      Method Pad, "ReColor"
      Method Pad, "Show"

Function File1.DblClick {
\\ we use functions As subs here
\\ each function and each module have a name (define a namespace)
\\ but here real module name is the File1.DblClick() host module
\\ this is done because is a Gui Event Service Function
\\ and is call with Local tag (Call Local)
      Read New File1index
      Local cont, cont2, f$, NL$={
      \\ Because we want some jumps..we use  On Goto
      \\ on Goto need here a block
      On File1index Goto Open1, Save1, ExitNow, ExitNow, ExitNow, ExitNow, Save2, ExitNow, Unload
      If Pad.text$<>BackUp$ Then {
            If Ask("Save Changes first?",title$, "Yes","No")=1 Then Goto Save1
     Layer NotePad {
           Open.file filename$,,"Load Text ("+typ$+") File",typ$
     Method Pad,"GetFocus"
     Read f$
     If f$<>"" Then {
           If Exist(F$) Then {
           Clear BackUp$
           Load.Doc BackUp$, f$
           Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
           Title caption$
           \\ silent means here without refresh
           With Pad, "SelStartSilent", 0, "SellengthSilent",0
           } Else Pad.text$="": Clear BackUp$
           Method Pad, "ReColor"
      Layer NotePad {
            Save.As Filename$,,"Save Text ("+typ$+") File",typ$
      If Not cont2 Then Method Pad,"GetFocus"
      Read f$
      If f$="" Then Exit
      If Lcase$(File.type$(f$))<>typ$ Then f$=f$+"."+typ$
      If Exist(f$) Then If Ask(NL$+"Overwrite"+NL$+f$,title$, "Yes","No")<>1 Then Exit
      Try ok {
        Clear BackUp$
        Save.Doc BackUp$, f$
        Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
     If ok Else Beep
     If Not cont Then Exit
      If Pad.text$<>BackUp$ Then {
            If Ask("Save Changes?",title$, "Yes","No")=1 Then Goto Save1
      Clear BackUp$
      If Cont2 Then {
            Method NotePad, "CloseNow"
      } Else {
            Caption$=TitleStr$(File.Name$(Filename$)) +" - M2000 Pad"
            Method Pad, "Resize"
      Cont2=True : Goto Save2
Function Help1.OpenMenu {
      Local A, info$
            This is an example
            of a notepad
            written for M2000 Environment
            use F1 to change wrap
      Method Pad, "GetFocus"

Call Local Notepad.Resize()
\\ open As moda
Title title$, 0
After 100 {Title title$}
Method NotePad,"Show" , 1
Declare Pad Nothing
Declare NotePad Nothing
Print "Done"

A : End

Posts : 26
Join date : 10/06/2016
Age : 52
Location : Kanallaki Greece

Επιστροφή στην κορυφή Πήγαινε κάτω

Επιστροφή στην κορυφή

Δικαιώματα σας στην κατηγορία αυτή
Δεν μπορείτε να απαντήσετε στα Θέματα αυτής της Δ.Συζήτησης