Results for "Author: roger gilchrist"
If you wander away from VB's built-in date handling (and even if you stick fairly close to it) eventually you will have trouble if users can input a date. While MS and the WWW have made most computer literate people used to the the USA format M/D/Y there are many others. MS recognises 3 MDY, DMY and YMD. There are also lots of date dividers '/-\,.'. If you don't provide a calander or listbox system to control date input then you have to program for end-users using their local format. The following article is a at least part of a quick and dirty answer to the problem. (article is also in zip for easier downloading in English and Indonesian)
A single class capable of drawing the solar system from Sun to Pluto (including 500 asteroids and 9 moons). You can easily add more or design your own solar system. At present the orbits are circular and the comments a bit thin on ground but should be enough to get you going. Thanks for inspiration, assistance and support to Peter Wilson whose upload 'A Simple Solar System Simulator, v1.0' http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=47973&lngWId=1 inspired this. -------------NOTE--------------------------------- If it runs too slowly reduce the number of asteroids at Private Const AsteroidNumber As Long = 500 . I have run it with up to 5000 but the graphic is not that much different and very slow. ---------UPDATED-------------------------------------------Thanks to Peter Wilson who imporved his zooming code and kindly sent it to me. Have added a new solar equator view, labels for planets and moons, improved collection based functionality, Asteroids do not display orbits (un-comment piece of code if you like that). All orbits are now ellipical and Pluto has its eccentric orbit (not accurate will get almanac from library to fix that). Planets have extra properties (oblate= Flat). ------------ CODERS this class automatically produces the labels it needs to operate without a seed control. Cute Trick extended on article in Computer Shopper Jun 2003.
I have noticed a few uploads where the code was just a bit off because of incorrect handling of the counter variable of a 'For' structure,so conducted some experiments. This is the result, nothing great but might help someone. It's a bit long so I zipped it as well, so you can read off-line. Additional input welcome.
Ver1.1.03 general tightening of code. Help file now has details of pattern searching and added optional gridlines for found box. Ver1.1.02 Now has pattern searching! Screen shot slightly out of date, have added better button graphics(on/off states), also fixed the bug in ver1.1.1 where first line of found overwrote the headings. Ver 1.1.1 Lots of new stuff (see Ver data at end of description) ver 1.1 uses grid tool instead of listbox to display finds. This is a re-write of my earlier Find Add-in using a UserDocument. Mostly just an experiment for a conversion of my Code Fixer. You can search for whole words, parts of words, case sensitive or insensitve, punctuation aware, ignore comments and strings or only find strings and restrict to current code page of code. Once launched you can also search for new items simple by selecting the word in code and pressing a button. Added settings screen which allows you to launch Tool on VB startup, save previous searches and filter settings between runs, set limits (20-400) on search history. For add-in programmers check the code around PasteFace command for a solution to the problem of destroying the clipboard contents when using this command and just below it the disgustingly simple way to make add-ins appear during VB startup sequence. To use Open project in VB, compile(placing dll in VB folder or where ever you normally store add-ins), close and re-start VB, in Add-ins menu select 'Add-in Manager..' look for 'ExFind_D' set 'Loaded/Unloaded' and 'Load on Startup' (NOTE this is NOT same as the 'Launch On Startup' setting within the program.) Version 1.1.01 The Status label has been removed; report on activity now appears in the Code column heading. Added a 'Clear History' button to Properties page. (also changed layout of form) Rearranged the toolbar buttons for more clarity Changed All/Current Code page button to toggle mode. Improved the shut down process to properly remove all forms/objects. Changed the way settings are stored to overcome problem with Registry storing boolean data on non-Engish Systems. Moved all Property load/save code into just 2 routines. (NOTE Property and Help form positions are saved separately by each form) Adjusted the Column width calculation to keep location data as small as possible. See 'Sub Show' on DocFind if you don't like the grid heading or selection colours. You can hard code what you want there.
This is a VB6 only Add-In that is a substitute for VB's own Find & Replace tool. It allows you to search your code and to see at a glance all occurrences of a search phrase in a list. You can also do pattern searching (including an ASCII Search Macro to find high ASCII characters like copyright). You can search and replace at 3 levels (all code, current code or current routine). You can also limit searching to just comments or strings or block comments and strings from searches. The Tool docks with VB's IDE and can be set to display during VB's start up sequence. There is a simple Help window (or read the rtf file in the Zip.) and a Properties window that gives you greater control of how the tool looks and behaves. To use: Compile the code, placing the dll in VB's own folder or whereever you keep your Add-Ins. Close VB and reopen it (WARNING VB may crash on exit; this is a problem with compiling Add-Ins, it should not happen later). Select the Add-in Manager and find the add-in called 'ExFind_D' check the 'Loaded/UnLoaded' and 'Load on Startup' checkboxes. This will add the Extended Find to the Add-ins menu. Click the menu item and read the help window for further settings. Because this tool uses a UserDocument it automatically remembers its size and location between runs. Please inform me if you wish to create VB5 (should be easy) or even VB4 (may not be so easy) versions and include acknowlegment in code/help/comments. If you wonder about the F> button on my toolbar in the screenshot use the 'Other Submissions' link and find my article on 'Full Compile' Thanks to users of earlier versions especially Dream and Sub-Zero for all their help in debugging. Comments, votes and bug reports welcome. -----------------------------------------Version 2.2.1 Pattern Search button disables Whole Word and Case Sensitivity buttons(If you could turn them on Pattern search would fail) To remove a single item from the Search History make sure the whole text is selected then press BackSpace. Fixed bug that caused eternal loop if search phrase occurred in last line of code. Removed Punctuation Aware; it is not needed for the program to opeate. Cancel button displays properly. Added macros to allow you to insert a NewLine or Tab character to the Replace combo. Added Auto Pattern search Off if Search phrase does not contain any Pattern search characters. Fixed Selected Range test can now cope with selection starting/ending properly. (was ignoring start/end of all lines in selection if Start/End were not at minimium/maximum values for whole range.) Changed Filter Warning message to make it easier to read at a glance. ver 2.2 Added Component and Procedure Line columns to Found Grid. Added Selected Text Range; don't know that anyone ever uses this but it is part of VB's Find and Replace so here it is. Rearranged Properties window Ver 2.1 See Additional Notes in help: Not fixes but stuff that's in the code but not previously explained. Added User selection of colours for Combos and Grid. History is now saved in correct order. Whole Word Filter automatically sets Punctuation Filter. Fixed bug Found List working properly Improved the way Found Grid copes with editing changing the hidden line number that Extended Find uses to speed finding. --------------------------------------------
Optimisation is not always about speed. The no-API Pause routine many people use is an example of this. Obviously a Pause should not be longer than you ask for so the more accurately the routine can detect the pause is complete the better it is. The routine gains accuracy because it spends less time working and more detecting. This is a very minor optimisation but the approach will help you in other optimisation work. ------------------------------------------------ See the PauseTutorial.txt file in the zip for more detailed explanations and check out the comments in the demo code for Command4_Click and Sub PauseLong for an interesting possibility for over optimising.
Here are 2 routines that create the illusion of human input to the Text or Caption property of a control. Inspired by zebba's "A Ghost typer ( useing timers )" txtCodeId=63737. No screenshot as its the movement/change that counts.
What do you do if you need a grid of controls? You can painstakingly draw them one by one in the IDE carefully sizing and placing each one OR use a computer to do it for you! This demo uses a form with 3 controls on it and a simple procedure (GenerateGrid) to create a program with 3456 (even more if you maximize the form; 16415 dots + the 26 other controls on my system) controls. To use this code simply create one control with the properties you wish to share (size, colour and shape are the usually ones) and set its Index to 0. This becomes the root control for the array. Place it on the form at the Top-Left position of your grid. Call the routine. I recommend this for creating tile based games where the positon and contents of the tile are not likely to change most of the time. While I use it as a graphics display in this demo I do not recommend it because control-based 'pixels' are very slow to create and manipulate as you can see in the demo if you maximize the form (and wait.. and wait... while it creates the controls) .
PC SPEAKER MUSIC KEYBOARD ClsKeyBoardPicture.cls OOPS! small upgrade. There was an error which meant a mouse move could change the duration value if there was too long between playing and outputing text. Also small change to the 'skins'. The speaker I mean the thing that goes beep to give POST messages during bootup,not built-in's multimedia stuff. This is a keyboard in a picture box class. It is part of a larger project but just to show that it is really free standing here is a small demo. The keyboard in this demo plays the PC internal speaker, and also outputs simplifed Basica and Nokia note codes. The keyboard has 3 built in 'skins'. Basica was a DOS ancestor of VB when the internal PC speaker was THE sound system, 16 colours was fantastic and 1 MB drives were a dream. This is a sub-component of a more complex notation writer with error checking and auto-correction that I am working on. Comments and votes welcome.
Version 3a: Update in response to reported error. FIXED: Translation of sharps between codes, first note dotted error. NEW:The New Basica Trick called BasicaRealTranspose is misnamed; at present it creates rather interesting changes to a tune but does not Transpose. This is a keyboard in a picture box class. The keyboard now supports almost all of the Basica Play command code (excepting those bits that can't be, or don't need to be, reproduced inside Windows). Basica and Nokia Composer and RTTTL code now allow dotted notes. Many examples in each supported code. There is a player piano mode when playing back code strings. There is a Nokia ringtone safe mode. The keyboard has 4 built-in 'skins' and a safety routine which keeps the colours safe. You can generate random skins and save them to a file for adding new 'skins' to the code. I have incorperated the code necessary to use the class in pre NT systems (thanks to Bob Richards for this code ('Quick Search' for "PC Speaker" to see original) but you will need to download the free .Dll file WIN95IO.DLL which is available from http://www.softcircuits.com (For Win9xMe systems ONLY, the file WIN95IO.DLL may be copied to the Windows/System folder or just drop it in folder with my code) The PC Speaker is not a multimedia add-on it is part of most computers' bootup system, the thing that goes beep (just once if all is well). If you don't hear it, check that you have not disabled it from SetUp or disconnected it while tinkering inside your machine. One day you will want to hear it as it signals that something fundemental has gone wrong (over the years; hard drive cables disconnected, unplugged keyboard and loose memory chips in my case). Also includes a work in progress clsVirtualScoreSheet. View code as traditional score. As you will see this is not fully developed and assumes 4/4 time for all pieces but does not quite achieive it. Useful for inputting from score sheets as you can check that you got the right note and duration. It does not scroll (yet) but it is resizable (just maximize the form). Hope to develop it to allow direct mouse editing of score as another input system. Comments, suggestions and votes welcome.
ClsExtendedRTF Version 2a OOPS SMALL UPGRADE FORGOT ABOUT LOW RESOLUTION SCREENS sort of fixed that and there's a small animation demo added as an apology. This code manipulates the underlying Rich Text format string in RichTextBoxes in several ways. Highlight text, add interesting, strange and weird formats to RTF text. Resize mixed sizes of fonts with one call. Add a Zooming ComboBox to any RichTextBox. CommonDialog is encapsulated to give File New / Open / Save / SaveAs / SafeSave and Reload functionality. ShowColor is also encapsulated. This is a more stable version of this code. Insertion point is preserved after changes to text. More of the work is done at string manipulation level. New details added see * below for version 2's new elements. Minimum Requirments Riched20.dll (version 3) Riched32.dll (5.00.2008.1) probably the Richx32.ocx control Highlight now comes in two flavours RTF and API there are advantages and disadvatages to each. Menu and Toolbar use API; Text Colour Panel (in Font Looks menu) uses RTF Incorperated my ClsManifestation (see help) It is behind the spanner button on the tool bar only useful in WindowsXP to choose between XP and Classic look for compiled demo. Does not work in IDE. Font Looks menu contains to Forms which can be added to other programs to give maximum freedom of using the Font format and colour options. Added new font colour choices. Improved Demo performance. Corrected many minor bugs(extra spaces, spaces being deleted) Added Zoom ability Broke up the original ClsExtendedRTF into a couple of separate classes. Rewrote, simplified and often renamed routines for speed and comprehension Please comment, vote and send me interesting formats you develop and I'll included them with acknowlegments. Feel free to take just the parts you want (leave copyrights etc) this class is still 'Under Construction' if you like check back for updates. Demo Program is also a test bed for experimenting with RTF. 'ExtendedRTF Code for VB6.rtf'is both the help file and the demonstation file and was created interactivly with the code. NOTE uses VB6 only routines but if you have work-rounds for them should work with VB5, VB4. Needs more recent versions of RichText control. ExtendedRTF provides: 1. Highlight (NOT the same as select) *more ways of accessing this facility. 2.Other Underlines wave,dot,dash, dashdot, dashdotdot, hairline, and thick. (word and double are partially supported; you can set them but they appear as single in RichTextBox, in Word they look fine) 3. Hidden text/images 4. Weird font formats. Ripple, HeightRipple, Ransom 5.Font colour schemes *Rainbow, *Spectrum and *Materials. 6.subscript, superscript,up and down RTF codes. RichTextBox recognises '\up' and '\dn' with as superscript but not '\sub' and '\super' ???? 7. Get current insertion point as percentage of total document 8. Remove excess spaces in selection or whole document. 9. File handling: routines to simplify standard New/Open/Save/SaveAs. *Reload routine reload last saved document without opening CommonDialog *Document loaded in IDE is automatically reloaded from disk. SafeSave routine place this in your exit program and file procedures and you'll never lose your edits again.
ClsExtendedRTF.Cls version 3 for RichTextBox extensive rewrite, recode and rename. Mostly about manipulating RTF code to change text and background colours. Now includes API and RTF based higlighting(Not selection, this is the RichTextBox equivalant of highlihter pens). Highlighting with: API advantage it can detect highlighting; disadvantage single colour at a time RTF advantage multicolour highlighting. disadvantage can't detect itself. ClsAPIZoom for RichTtextBox, a few lines of code and your RTBox is zoomable. cLsManifestation (incorperated from my other upload) Gives compiled program user's choice of Classic or WindowsXP(if they have XP) added panels(form) which give you greater control over highlight, text colour and text format. *New* Materials interface you can create your own materials colour schemes. *New* Styles; if you create a text and background colour scheme you want to reuse save it with a name and access through the RTF Font Painter tool and class. fixed small bug in RemoveFormatting which added a space to start;(if selection was at start of doc) see earlier versions for mor details.
Cls StackCollection Use VB's Collections to build stacks and queues. Also included a safety wrapper for collections. To operate as a stack/queue you do not need a separate key, everything is done using the index This class adds new Methods and Properties to VB collections. ArrayFromCollection Put contents of stack into an array ArrayToCollection Load members of an array into the stack Bottom: Returns first value added to stack Clear: Empty stack in one call Exists: Tests if index/Key is in stack. Uses error trap to test Optionally runs silent if error occurs Extract: Remove any member from stack Invert: Reverse order of stack Max: Returns the highest alphanumeric member of stack Middle: Returns Middle member of stack Min: Returns the lowest alphanumeric member of stack. Pop: Use collection as a LIFO (Last In First Out) stack, removes member from stack. Pull: Use collection as a FIFO (First In First Out) stack, removes member from stack. Push: Wrapper for VB standard Add. Push is used by both LIFO & FIFO stacks. QuickSort: Sort stack into alphanumeric order RandomMember: Extract a random member of the stack(Optional RemoveIt as Boolean = False); if True remove from stack Replace: Change the Item for an Index/Key Shuffle: Randomise the contents of the stack Top: Returns last value added to array I have also included a class ClsSafeCollection which wraps the standard collection in a safety net Add: Modified to allow you to cope with the various error conditions that can occur Count: VB standard Collection.Count Item: Modified to allow you to cope with the 'Index/Key does not exist' error Remove: Modified to allow you to cope with the 'Index/Key does not exist' error Please comment and vote. May just have reinvented the wheel for many of you but hope you find some use for it. Feel free to use all or parts of this but leave copyrights in place and let me know about it at rojagilkrist@hotmail.com
This is a demo of how to use AddressOf to obtain information about font families. Unfortunately AddressOf cannot work from classes so it isn't exactly what I needed but it is useful. You can quickly fill a listbox or collection with font names meeting specific conditions. Some FontTypes are not on my system so while I built a detector for them I cannot be sure they work. Comments and votes welcome. Feel free to use all or parts of this but leave copyrights in place and let me know about it at rojagilkrist@hotmail.com
Frx files are a vital part of almost any VB code but many people forget to upload them. This article explains how they work and why you should include them in your uploads. Article also in a zip file for reading off-line.
Colour Percentage Fader Inspired by 'ColorFade' upload. Code lets you choose the start and end colours for a simple colour percentage bar. Screenshot added as requested
merry new year and a happy christmas to all at PSC. Inspired by 'Singing Reindeer' by Chris Seelbach at xtCodeId=57776; any votes go to him. No Screen shot (it's a surprise but check Chris's version for a hint) I decided to developed a christmas tree using the ideas (and the graphic) in the original. In the process I realised there were some problems in the original (artifacts around the animated bits cleverly hidden by careful backgrounding). I thought I'd try to make a single super deer UserControl but couldn't extract the images from the original controls, so developed mouth and eye UserControls (using the images that I could extract and some screen captures) that are designed to be placed on the main usercontrols. ----------- Time presses so not much commentry but will develop it into a tutorial over the break as there is some quite trick stuff going on here. ---------------- Thanks Tom Law for catching that I left out the sound files, check the file times, it was laaaaate.
Inspired by 'An old-fashioned Billboard Marquee' txtCodeId=51571 which is good looking but not very portable I built this class. I have always felt that if you need a large number of controls you should use the 'Load' command not painstakingly apply over a hundred controls. If you change resolution this can be very painful to upgrade. This class simple creates (and deletes) controls on the fly using just one indexed Image control as a seed. If you make a large change in the size of the marquee there is a slight delay. The screenshot doesn't really tell you much (no movement) just imagine all the little disks (yellow dots) moving
This is a VB6 only Add-In that is a substitute for VB's own Find & Replace tool. It allows you to search your code and to see at a glance all occurrences of a search phrase in a list. You can also do pattern searching (including an ASCII Search Macro to find high ASCII characters like copyright). You can search and replace at 3 levels (all code, current code or current routine). You can also limit searching to just comments or strings or block comments and strings from searches. The Tool docks with VB's IDE and can be set to display during VB's start up sequence. There is a simple Help window (or read the rtf file in the Zip.) and a Properties window that gives you greater control of how the tool looks and behaves. To use: Compile the code, placing the dll in VB's own folder or whereever you keep your Add-Ins. Close VB and reopen it (WARNING VB may crash on exit; this is a problem with compiling Add-Ins, it should not happen later). Select the Add-in Manager and find the add-in called 'ExFind_D' check the 'Loaded/UnLoaded' and 'Load on Startup' checkboxes. This will add the Extended Find to the Add-ins menu. Click the menu item and read the help window for further settings. Because this tool uses a UserDocument it automatically remembers its size and location between runs. Please inform me if you wish to create VB5 (should be easy) or even VB4 (may not be so easy) versions and include acknowlegment in code/help/comments. If you wonder about the F> button on my toolbar in the screenshot use the 'Other Submissions' link and find my article on 'Full Compile' Thanks to users of earlier versions especially Dream and Sub-Zero for all their help in debugging. Comments, votes and bug reports welcome. -----------------------------------------Version 2.2.1 Pattern Search button disables Whole Word and Case Sensitivity buttons(If you could turn them on Pattern search would fail) To remove a single item from the Search History make sure the whole text is selected then press BackSpace. Fixed bug that caused eternal loop if search phrase occurred in last line of code. Removed Punctuation Aware; it is not needed for the program to opeate. Cancel button displays properly. Added macros to allow you to insert a NewLine or Tab character to the Replace combo. Added Auto Pattern search Off if Search phrase does not contain any Pattern search characters. Fixed Selected Range test can now cope with selection starting/ending properly. (was ignoring start/end of all lines in selection if Start/End were not at minimium/maximum values for whole range.) Changed Filter Warning message to make it easier to read at a glance. ver 2.2 Added Component and Procedure Line columns to Found Grid. Added Selected Text Range; don't know that anyone ever uses this but it is part of VB's Find and Replace so here it is. Rearranged Properties window Ver 2.1 See Additional Notes in help: Not fixes but stuff that's in the code but not previously explained. Added User selection of colours for Combos and Grid. History is now saved in correct order. Whole Word Filter automatically sets Punctuation Filter. Fixed bug Found List working properly Improved the way Found Grid copes with editing changing the hidden line number that Extended Find uses to speed finding. --------------------------------------------
I have noticed a few uploads where the code was just a bit off because of incorrect handling of the counter variable of a 'For' structure,so conducted some experiments. This is the result, nothing great but might help someone. It's a bit long so I zipped it as well, so you can read off-line. Additional input welcome.