I was thinking that a good project to help me learn, and one that would be useful, would be to write a code library for myself, to store the various bits and pieces I have scattered all about the place.
I was just wondering if people who have already written one for themselves would make some suggestions as to the layout and which controls they have used.
Have they saved the files to a database (not done this yet but ...)
or are they saved as text files in a folder etc.
Any suggestions would be a great help to get me started.
Thanks
aikidokid
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way:
I actually made something like this, that let me put in descriptions, function names, parameters etc. It then formatted it into a HTML file so that I could put them all in a *.chm help file
Under each code category are routines or snippets that I've either written or glombed from other sources.
When I find what I'm looking for (a good search feature is indispendsible....I just wish I had one ), I click on the node and the associated code is displayed in a Richtextbox.
You can also drag/drop another node to this listview if the codes are related. It will create a direct 'link' to that node (code).
What are you draging and dropping?
I have a function that will programmatically create a new node under the Parent Node of Source Code, but I'm not getting what could be dragged and dropped.
I mean, the editor is currently showing "HScrollBar" code.
The "SmoothScrolling" code is somewhat related.
Drag&Drop the "SmoothScrolling" node on the listview of "HScrollBar" code, and it will create a 'link' for the "SmoothScrolling" node.
I have a function that will programmatically create a new node under the Parent Node of Source Code, but I'm not getting what could be dragged and dropped.
These are my existing Treeview nodes. When I need to add another (for a different development platform) I can either right click on the Parent "Source Code" node, click one of the toolbar buttons or access a drop down menu under Edit, enter the name of the new platform node and it creates a record for me in my database, which is used to populate the treeview.
I mean, the editor is currently showing "HScrollBar" code.
The "SmoothScrolling" code is somewhat related.
Drag&Drop the "SmoothScrolling" node on the listview of "HScrollBar" code, and it will create a 'link' for the "SmoothScrolling" node.
So, in effect, you are creating a "favorites" list?
As I said, my application originally was a 'generic' note-taking s/w, so I used zipped rtf to store text and pictures (pic of the table).
Unlike your app, I don't have any "Add New Code" form. Every code and 'normal notes' in my app are treated as 'normal notes'. It helps me to store codes+descriptions+screenshots in same place. (But searching becomes a little less accurate. )
When you want to add a new code, you need to manually create the note, select the code and select appropriate syntax file from the "syntax" menu for formatting.
You should build an Add New Code thing for your app.
For me, my "Search" leaves MUCH to be desired. For quite a while I've been telling myself I need to overhaul that thing and make it more robust, and more accurate, but as I'm the only person that uses it, I keep putting it off until "some day".
My Library also has the ability to rename a Code entry and to move an entry from one category to another (I forgot about those yesterday as I don't use them all that much, but they are really handy when you need them.)
Oh Yes. My app has these features too. aikidokid, you should add these in your app.
Another feature I wanted to add (but couldn't finish intime), is adding zip attatchments.
My idea was to add a working example project in a zip archive with the snippets. Upon doubleclick the app will autometically extract the zip file in Temp directory and ShellExecute the project/solution file.
Sometimes a code snippet needs some pictures/other files etc. This 'attatchment' feature can be used to store them too.
Now that we are on this topic, I started looking around at my menus and discovered things I'd forgotten I'd built in, like:
I have an MRU list for the last 4 code items I've viewed.
I can dump a code snippet to a text file or 3.5 disk ( when was the last time you saw a 3.5 diskette )
I also have the option of running my Library from my desktop or the system tray (which is where is always is)
Ah, makes sense, and the font size is just another combo with the numbers in it, and then the code takes this value and does the rest - correct?
To get the font sizes (where cboFonts is the combo with the font names)
Code:
Private Sub LoadFontSizes()
Dim SaveName As String
Dim SaveSize As Single
Dim Sizes As Variant
Dim i As Long
'place holders for font name and font size
SaveName = cboFontSize.Font.Name
SaveSize = cboFontSize.Font.Size
Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72)
cboFontSize.Clear
'this is the font the user has selected
cboFontSize.FontName = cboFonts.Text
'whip through the array checking all possible font sizes
For i = LBound(Sizes) To UBound(Sizes)
cboFontSize.FontSize = CLng(Sizes(i))
'font supports this size, add to combo
If cboFontSize.FontSize = CLng(Sizes(i)) Then
cboFontSize.AddItem Sizes(i)
End If
Next
cboFontSize.FontName = SaveName
cboFontSize.FontSize = SaveSize
End Sub
Oops Just pressed save instead of preview changes!
Just so I understand this code, I have gone through it commenting each line.
Would you check that I have understood it correctly please.
Thanks.
Code:
Private Sub LoadFontSizes() <------added into form code
Dim SaveName As String
Dim SaveSize As Single
Dim Sizes As Variant
Dim i As Long
'place holders for font name and font size
SaveName = cboFontSize.Font.Name <---------creating arraysSaveSize = cboFontSize.Font.Size
Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72) <----------loading elements of size arraycboFontSize.Clear <--------------emptying cmb - box
'this is the font the user has selected
cboFontSize.FontName = cboFonts.Text <---------setting the font style value to what the text already is??
'whip through the array checking all possible font sizes
For i = LBound(Sizes) To UBound(Sizes) <-------Not to sure here. What is Clng(Sizes) - where is it dimmed?
cboFontSize.FontSize = CLng(Sizes(i)) <------changes the size showing in the size combo box 'font supports this size, add to combo
If cboFontSize.FontSize = CLng(Sizes(i)) Then <---if size is supported by this style font then add to cmb box cboFontSize.AddItem Sizes(i)
End If
Next
cboFontSize.FontName = SaveName <-----set the values to the combo boxes cboFontSize.FontSize = SaveSize
End Sub
Last edited by aikidokid; Feb 27th, 2007 at 11:26 AM.
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way:
And, I noticed I forgot to mention, you would call that sub from the click event of cboFonts
So when you click on the font style combo it checks this code to check for supported sizes for that font.
When the app first starts, as the cmbFontStyle is loaded, does this automatically fire this code, or would I have to call it the first time the style is selected?
If so, what if I used the default font style?
Thanks
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way:
In that code "GetSetting" I assume is the code to call the values from the registry? I will look into that later.
I am running this code, both in the form load and when the cboFontStyle box is clicked.
Now don't ask me why, but it is showing every third element from the array'
EG
6, 9, 12, 18, 24 etc???
Also, how would I know the correct ListIndex to set at start time?
Oh - forget that, just realised what you said about the registry.
BTW, How do I get the seperator in the MenuEditor?
Thanks
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way:
Thanks for the seperator example, I wasn't too far away, I was adding a line of dashes
I took a look at the registry thread you suggested, and I will come back to this a bit later.
As for the problem loading the cboFontSizes, I have stepped through this and it loads all of the values into the cboFontSize, but it only displays what I mentioned before, every 3rd entry.
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way:
Thanks ever so much Hack, your time is appreciated :thunb:
I'm not sure if I am missing something here, but in your example it only showed the values in the cbofontsize as mine did. I checked in MS Word and it uses all of the sizes you added to the array.
Why is it only showing these values and not all of the expected values?
If somebody helps you, take time to RATE the post. I do.
"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Below are some of the threads that have helped me along the way: