dcsimg
Results 1 to 10 of 10

Thread: Code Bookmarks Add-In ???

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Code Bookmarks Add-In ???

    Ok, I've got my head all full of Add-Ins these days, and I thought I might have some fun with ideas in this thread.

    Ok, I know about the IDE's Ctrl-Shift-F2, but I'd sometimes like more bookmarks than that saves.

    I've just been brainstorming with myself, and come up with this. Six buttons (on the Standard toolbar). Here are my proposed ToolTips:

    1. Goto Prev Bookmark
    2. Mark/Set Bookmark
    3. Goto Next Bookmark
    4. Save Project's Bookmarks
    5. Clear Project's Bookmarks
    6. Clear ALL Bookmarks

    And here's the proposed way it'd look on the toolbar:

    Name:  Bookmarks.png
Views: 181
Size:  9.1 KB

    Keep in mind that I want to limit myself to the available Office Toolbar icons. That keeps the Add-In from fouling up the ClipBoard. Therefore, if you'd like different icons, please provide me with the Office FaceID that you're thinking about. (I'll let you work out how to get those FaceIDs. Those FaceIDs are 1017, 376, 1018, 1713, 1716, 1670, respectively.)

    As a first pass, I probably won't make it work with VBG groups, but it probably won't be too hard to do that. (Actually, the more I think about it, I'll probably still store the bookmarks per project, but just allow the Add-In to handle more than one bookmark collection (one for each open project).

    I think the ToolTips make it clear what the buttons would do.

    I'm thinking of using the registry to store the bookmarks (the last three buttons), but I'll set it up so that it's all in one registry key. The "Clear ALL Bookmarks" would totally clean-up anything the Add-In placed in the registry. But using the registry in this way provides one big advantage to Ctrl-Shift-F2 ... these bookmarks would be persistent across different executions of the IDE (for the same project). I guess the Add-In will check-and-read the registry when a new project is opened. I'll have to work out the best way to differentiate among different projects.

    I'm going on a trip for a few days, so I probably won't make much headway for a bit, but I probably will get this going.

    I'm open to ideas, so long as no one takes offense if I don't incorporate those ideas. But, the reason I'm starting this thread is to hear/listen to those ideas.

    I've already created a little "Stub" project. I'll post that, just for grins.

    Y'all Take Care,
    Elroy
    Attached Files Attached Files
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  2. #2
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,581

    Re: Code Bookmarks Add-In ???

    Quote Originally Posted by Elroy View Post
    I'm thinking of using the registry to store the bookmarks (the last three buttons), but I'll set it up so that it's all in one registry key.
    Can you store bookmarked line numbers in project's .vbp file under a designated (custom) section as a single entry containging a comma separated list?

    Edit: Note that if you are going to impl this as an SDI only add-in, rest of us are going to stop any further feedback :-))

    cheers,
    </wqw>

  3. #3
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    443

    Re: Code Bookmarks Add-In ???

    You could store bookmark infos in Local APP Data by using this short code:

    sFileName = Environ("LOCALAPPDATA") & "\VB6Bookmarks.ini"

    You could use the API, but that is just one line.

  4. #4

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Code Bookmarks Add-In ???

    Quote Originally Posted by wqweto View Post
    Edit: Note that if you are going to impl this as an SDI only add-in, rest of us are going to stop any further feedback :-))
    Hi wqweto,

    No no, I don't see why this one would be limited to SDI. All that "Selected Controls" stuff was SDI because I used the Owner/Owned (not Parent/Child) relationship between the designer form and my Add-In form. Using that Owner/Owned relationship allowed me to show the Owned (Add-In) form without it ever needing the focus, make sure it was always on-top of the designer, and also make sure it was closed whenever it's Owner-Designer was closed. I couldn't figure out how to do all of that without using the Owner/Owned relationship (which required that the designer forms be top-level, and therefore the IDE in SDI mode).

    Just as a further FYI, I tried always-on-top, but that stole the focus for a moment, even if I immediately put it back on the designer form. When the designer form lost the focus (even for only a few CPU cycles), that caused other problems in the IDE. They're probably solvable, but it'd be a substantially different project. Therefore, all that "selected controls" work was stuck in the SDI world.

    Regarding this idea, there won't be any over-lain Add-In forms, so I think it will work equally well in either SDI or MDI mode.

    Also, I hadn't thought about saving the bookmarks in the VBP files. That's a good idea, and I'll explore it further.

    @qvb6: I'm not sure why, but storing even a moderate amount of data in the OS's environment space seems scary to me. That's one area I've never used for anything. I suppose I've read it, possibly to examine the default paths, but I've never written anything to it. And I've got no idea how much space Windows sets aside for the environment. Personally, I'm thinking the registry would be much safer. But, thanks for the idea.

    -----

    Also, I just realized that VB6 actually DOES have bookmarks.

    Name:  Bookmarks2.png
Views: 100
Size:  7.3 KB

    In all my years of VB6 programming, I've never used them, and really didn't even know they were there. Although, they're not persistent (or at least I don't think they are), so, my project still has value.

    -----

    I'm traveling (a friend's wedding), so it'll be a couple of days before I actually get going on this ... but, thanks.

    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  5. #5
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    443

    Re: Code Bookmarks Add-In ???

    Quote Originally Posted by Elroy View Post
    @qvb6: I'm not sure why, but storing even a moderate amount of data in the OS's environment space seems scary to me. That's one area I've never used for anything. I suppose I've read it, possibly to examine the default paths, but I've never written anything to it. And I've got no idea how much space Windows sets aside for the environment. Personally, I'm thinking the registry would be much safer. But, thanks for the idea.
    I guess you are very busy, I wasn't suggesting storing information in the environment, but obtaining the path to Local App Data. This folder is always writable. The code I posted would give you this for sFileName:

    C:\Users\<UserName>\AppData\Local\VB6Bookmarks.ini

    You could get the same information by using SHGetFolderLocation(CSIDL_LOCAL_APPDATA Or CSIDL_FLAG_CREATE), but the code that I posted is one line. The disadvantage of using Environ() is that the folder may not exist for a user that has just been created. The API offers a flag to create that folder if it didn't exist, but if VB6 is installed, I have no doubt that the folder already exists.

    I do like wqweto idea of saving the data in the VBP file. Saving to the registry(to HKEY_CURRENT_USER) in some cases doesn't work as expected. If a user logs in/out of a domain, the user's profile, which includes HKEY_CURRENT_USER(This key resides in the file C:\Users\<UserName>\ntuser.dat) and AppData(Except Local) gets transported back and forth to the domain computer, so the user icons and desktop settings remain the same regardless of which computer they logon. So you could have a mismatch if you are using the registry, since the user could log on into a different computer that doesn't have the same VB project. In some cases, like terminal servers; the admin can specify that the profile is "read only", I think by using special prefix like * before the path to the profile. This means that the profile is writable, but the changes are thrown away during logoff, so the user have consistent experience. This is meant for guest users that try a demo, or to make instructions to employees consistent. Local App Data as the name implies; is not transported, so it's safer to use.

  6. #6

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Code Bookmarks Add-In ???

    Hi qvb6,

    Yeah, I'm back from my son's wedding now, and back to work. Thanks for the reply. Yes, the AppData\Local is certainly a spot where I could store things. However, I too like Wqweto's idea of the VBP file. I'll probably be exploring that more. Also, if I do this, I'll probably just enhance the existing IDE's bookmarks, giving them a persistent save feature. I've got a few other things to catch up on first.

    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  7. #7
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,387

    Re: Code Bookmarks Add-In ???

    Thinking out loud a bit re: storing the bookmarks in the VBP file - I know it's not that common for projects to be shared amongst multiple programmers, but some projects are. If the bookmarks are stored in the VBP file then they would be a shared resource unless you have some way of adding a user token as well. I think AppData\Local or AppData\Roaming would be better choices with that in mind - Roaming is good for users that jump around on different computers within a domain, but I wonder if storing bookmarks in both Roaming and Local would be the best choice (for those who hop on and off domains)?

    That said, if you find a way to uniquely identify users and create a token for bookmarks and store them in the VBP, maybe that would be good too, although it could mean some cruft when passing projects to others or publishing them here. They would end up carrying your bookmarks around forever even though they would never be used.

    Maybe there's not a perfect solution for this one, but I thought I'd give my 2 cents.

  8. #8

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Code Bookmarks Add-In ???

    Hi jpbro,

    When I get to this, I'm still thinking that storing in the VBP is the best option. Storing in two (or more) places brings up all kinds of sync issues I don't want to deal with. Also, I'll definitely have a "delete all the project's bookmarks" option, which will clean-up the VBP file.

    Also, regarding project sharing, personally, I thought sharing those bookmarks may have some advantages to it. You could just tell your co-worker to bounce around within the bookmarks to see what you're working on. IDK, I guess there are pluses-and-minuses to everything.

    However, now that I'm back home, I might look into making some of my other add-ins more MDI compatible before pursuing this further. I'll let y'all solve the primary problem (in another thread).

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  9. #9
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,224

    Re: Code Bookmarks Add-In ???

    Hi Elroy,
    Are you aware of/ familiar with this add-in -
    https://darinhiggins.com/2012/07/26/...addin-for-vb6/
    https://archive.codeplex.com/?p=bookmarksavevb6

    I have not tried it yet
    Years ago MS XP updates gradually deteriorated my VB6 IDE, to the point I had to wipe the drive and re-install XP. I am a man that keeps an OS running for over a decade, so that wipe really annoyed me with MS. Apart from installing XP SP3, I have never let MS updates touch my XP again. Perhaps that combined with my KISS approach explains why I have never tried any add-ins in my IDE.
    Others may care to give it a bash and report back ?

    Whilst on the subject of add-ins. Some members may be interested in the last free version of MZ-Tools -
    https://web.archive.org/web/20150206.../mztools3.aspx
    I don't think bookmarks are well covered in that (aka Favorites)

    Rob
    PS Elroy, I have been using VB6's (non permanent bookmarks) for years. Very handy when investigating a bug, or some other feature I am currently exploring.

  10. #10

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Code Bookmarks Add-In ???

    Hi Bobbles,

    Yes, I haven't really been enamored with VB6's Add-Ins either. I do make extensive use of the Resources Editor, but that's the only Add-In I regularly use that I didn't write. I also take the KISS approach with much that I do ... and I especially take that approach with Add-Ins. That's the primary reason I've never seriously considered any of these all-encompassing Add-Ins. An Add-In can easily crash the IDE. Therefore, the more all-encompassing, the more likely I might find a bug that crashes my IDE before I've saved my work.

    If you've looked at my Add-Ins, you'll see that they're each very specifically purposed. I just see no downside to having several small Add-Ins, with each doing a specific task. This allows us to mix-and-match, to get precisely what we want. Also, all of mine are open-source so you can see exactly what they're doing.

    Anyway, I'm sure I'll eventually get back to this persistent code bookmarks project, but I'm not sure when.

    Take Care,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width