Announcement

Collapse
No announcement yet.

Using PB/Win - a tip/trick

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using PB/Win - a tip/trick

    This might be of interest to many of you.

    When I'm editing a file and want to temporarily move away from that part of the code, I create a new line and type in something like "xx" - something that won't compile.

    Then, when I'm ready to come back to that spot, I simply press Ctrl-E and the compiler jumps to the bad line. I use it all the time to temporarily tag a location in my code

    Anyone else have a tip for using PB/Win?

  • #2
    It's a good idea

    I use "#####" (five hashes) commented out to mark an area of code that needs attention. The more hashes on a line the more severe and important the problem! If I get distracted and have to stop programming then I put in a couple of uncommented hashes so I don't lose track.

    Also a good idea is to have a "todo" file for each project you work on - just a simple text file with notes on each line. If it's a large project then have two text files, one for urgent things and a second for "future additions" (ie. ideas).

    There are also other things that are often overlooked:- structure, formatting and comments. Keep to a formula so the code is easy to read when you come back to it (sometimes years later).

    If you find yourself doing a repetitive task over and over, why not write a short program to automate the task? - easily done in PB. Same goes for code snippets - build a small library of functions that you can #INCLUDE so you don't have to keep rewriting or copy/pasting the same code.

    Also, backup, backup, backup
    Last edited by Kev Peel; 8 May 2009, 11:40 PM.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Bookmarks and code finder

      Help, Contents, Integrated environment, Hot keys, print page.

      1) Set bookmark : [ALT]+ 0-9
      2) Go to bookmark: [CTRL]+ 0-9
      3) See all bookmarks: [CTRL]+ B
      Shows each bookmarked line with option to jump to any of them.

      [F2] Code finder lists all functions/subs with option to jump to any of them.
      Last edited by Mike Doty; 9 May 2009, 09:11 AM. Reason: Formatting
      The world is full of apathy, but who cares?

      Comment


      • #4
        "trick": what someone else does.
        "technique": when you do the same thing.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Gary's tip is a good one. Have been using it for years. Sort of quick bookmark shortcut.

          A "technique" I like to use is in long subs/functions is when a descrete section of code (say a long For/Next loop) within the sub is working to my satisfaction, then put it in a descriptive Macro. It makes the code easier to follow. Ditto using long descriptive varialble names for arrays, etc.
          Code:
          ' *******************************************************
          '
          Sub Do_Lots_of_Stuff 
          '
            Open_the_Stuff_File 'macro
          '
             Count_The_Stuff 'macro
          '
             Work_on_The_Stuff 'macro
          End Sub
          '
          ' *******************************************************
          '
          Macro Count_The_Stuff 
            For ctr = 1 To lots
                If Item(ctr) = Valid Then
                   Incr Good_Stuff
                  Else
                   inct Bad_Stuff
                End If              
           'Lots more lines here     
            Next ctr
          End Macro
          '
          ' *******************************************************
          '
          Macro Work_on_The_Stuff
            'Lost of lines in here
          End Macro
          '
          ' *******************************************************
          '
          Macro Open_the_Stuff_File
            fnum = FreeFile
             Open "Stuff.Data" For Input As #fnum
             'Yadayadayada 
             'Yadayadayada 
             'Yadayadayada 
             'Yadayadayada 
             'Yadayadayada         
          End Macro
          '
          '
          ' *******************************************************
          '
          The only problem with using Macros thus is if there's an error, the compiler points to the macro name, not the actual error and can be a pain to navigate to.

          Another "trick" I use is to use a key replacement routine (ShortKeys) to save typing. For example:

          `u = using$("#, ", )

          `8 =
          '
          ' *******************************************************
          '

          `f =For ctr = Lbound() to Ubound()

          `c = & $CrLf

          ===========================
          "First they ignore you,
          then they laugh at you,
          then they fight you,
          then you win."
          Mahatma Gandhi (1869-1948)
          ===========================
          Last edited by Gösta H. Lovgren-2; 9 May 2009, 11:00 AM.
          It's a pretty day. I hope you enjoy it.

          Gösta

          JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
          LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

          Comment


          • #6
            When I'm editing a file and want to temporarily move away from that part of the code, I create a new line and type in something like "xx" - something that won't compile.
            This works as long as the compiler gets to it, that is, doesn't find a host of other non-compilable code first.

            I sandwich the section of code I'm working on between two bookmarks.
            Rod
            In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

            Comment


            • #7
              I use the bookmarks, too, but I had totally missed the CTRL+B 'go to bookmark' screen.

              So today I gave that a try....

              A.... I did not realize bookmarks work across files (really handy for me)
              and
              B...
              I found what I think is a weakness, so I sent in a New Feature Suggestion:

              5/9/09

              ^B show "go to bookmark" screen:

              Does not show "which bookmark number (0 to 9) " each entry is! And does
              not just use row # = Bookmark number, it squashes them up so no unused rows

              Really bad if you forget and you tend to assign from both ends!!!

              Suggestion: Add column for "bookmark number" (far left, column zero would
              be easiest to read and understand)
              AND (since screen will never be more than 10 lines)
              Leave blank rows on the screen when bookmark # "n" is not currently defined.
              You can send this in, too; for "it is said" the more who ask, the more likely we are to receive.

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                JellyFish Pro does not limit Bookmark (apparently 10 in PB Ide). from JF Help:

                Bookmarks

                Placing a "bookmark" in JellyFish Pro allows you to select a position in the file that you can quickly return to. You can place as many bookmarks as you wish in a file.

                If you are using a JellyFish Pro's Project then the bookmarks are saved between JellyFish Pro sessions.

                When a bookmark is set you will see an icon to the far left of the line. Note: You must have the "Show Left Margin" option checked in order to see the bookmark icon. To activate this option select "View", "Editor Options", and click on the "Misc" tab. Check the box called "Show left margin".

                To toggle a bookmark press Ctrl+F2 (or select "Toggle Bookmark" from the "Search" menu). Pressing Ctrl+F2 once will set the bookmark. Pressing it a second time will clear the bookmark.

                To quickly navigate among several bookmarks in a file, use the the F2 (Next Bookmark) and Shift+F2 (Previous Bookmark) keyboard shortcuts.

                You can clear all bookmarks in a file by selecting "Clear Bookmarks" from the "Search" menu or by pressing the Ctrl+Shift+F2 keyboard shortcut.
                ======================================
                "The greatest thing in this world
                is not so much where we are,
                but in what direction we are moving."
                Oliver Wendell Holmes
                ======================================
                It's a pretty day. I hope you enjoy it.

                Gösta

                JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                Comment


                • #9
                  In the CC arena, I frequently need a sub/function from another program to copy over to the one I'm working on.

                  Instead of opening the file in a new window, I simply bring up another instance of CC, open the target file, copy the sub/function to the clipboard and paste it into the program I am currently working on.

                  Believe it or not, it's faster than opening, copying, closing and pasting. Also, frequently faster than "file > insert" then deleting the unwanted code.
                  There are no atheists in a fox hole or the morning of a math test.
                  If my flag offends you, I'll help you pack.

                  Comment

                  Working...
                  X