|
First of all, the information displayed here is also available in the
class declaration. The download link is at the bottom of the page... YES,
you are supposed to read all this before using it...
This class provides the management of Memory Zones
for encapsulation, control, and added functionnalities. It was written
by Fabrice Harari - Contact fromweb@fabriceharari.com.
The text below describes the main added functionnalities.
Each method header contains it's description and the diferences with the
regular WD syntax
You can use this code freely in any application with
no restriction, as long as you don't remove the author name, coordinates
and all this beautiful legal stuff from it.
A note in your application help file or about window
would be appreciated but is not mandatory. Something along the lines of:
"Memory zones management code by Fabrice Harari - www.fabriceharari.com"
Intellectual property of this code always remains
mine.
You cannot resale this source code by itself, but
you can do so if it's part of an application that you are resaling. In
that case you must advise the buyer of the conditions above.
You can contact me for any question or comments about
this code. If you find bugs, please report them to me (with the correction
if you can :-)
You can also ask for a new functionnality. I cannot garanty a quick answer
or that your wishes will be granted, but all emails will be carefully
considered.
If you want to modify the behavior of this class,
it is highly reccomended that you do so by deriving it, allowing you to
use new /versions of the main class when they will be availble.
You can always find the last version of this class
along with other WinDev related tools/softwares and files on the WinDev
section of my web site: windev.fabriceharari.com
Why using this class instead of the regular MZ instructions:
- A regular MZ is global to the project, which can lead to memory leaks
very easily. With an object encapsulating it, you can choose where this
MZ is visible, and also it's life span. If you declare a static MZ object
in a window, it will be cleared from memory automatically when the window
closes. If you declare it dynamic, it wil stay available for as long
as you want
- If you use the same name for two MZ at different places, the second
will overwrite the first. This class gives unik names automatically
in the constructor. You don't have to worry about it
- A regular MemSeek is only able to do identical search... In this
class the research method is also able to do a Contains/starts_by/Ends_by
research. Also possible: fuzzier comparison.
- The search can also be done if the MZ was NOT sorted (slower, but
possible when the order in the MZ is significant and shouldn't be changed
- You can define a sort behavior: Manual (by default) (you are in charge
like in a normal MZ) or Auto (each time you add/Modify a line, the MZ
is sorted)
- The class auto-register all created objects/MZ. You can at any point
list all of them, access their objects, and list their contents (very
usefull for debug)
- If you just want to use this class as a garbage colection solution
for MZ, you can: create the MZ object, get the name of the MZ used for
it, and then manage it manually with the regular MZ orders. If you want
to use the full power of this class, use the internal orders instead.
If you delete the MZ manually, it will be recreated automatically next
time you access any of the methods, minimizing the risk of errors.
- You don't have to worry about testing on MemExist, it's done automatically
in every method where it's necessary
- If speed is of the essence, using methods of an object instead of
direct MZ calls is clearly a bad idea... The GetMZName method allows
you to use direct MZ syntax when optimisation is your target, and still
use the extended functionnalities by calling the class methods only
when you really need them.
- The class is using the same methods names than the regular MZ Syntax
(nothing new to learn), only adding new parameters to extend the functionnalities
when needed
- French and English syntax is provided, but for speed purpose, it
is reccomended to use the english one. The french methods are just relaying
to the english ones.
- All the regular Windev methods are waiting for the MZ name. As this
class manage the name internally, you can send an empty string or even
nothing when there is no other parameter.
The regular WinDev methods doing something different
are listed here (see method header fo details):
ALL METHODS: are testing for the MZ existence and recreating it if necessary...
The following methods are doing other things differently. This doesn't
mean that you HAVE to change your way of using them, it just means that
you CAN, if you want to benefit from extra functionnalities:
- MemDelete
- MemExist
- MemExiste
- MemModifie
- MemModify
- MemPositionne
- MemRecherche
- MemSeek
- MemSetPosition
- MemSupprime
The EXTRA methods are listed here (see method header
for details):
- GetMZName
- GetMZTitle
- ::GetObjectsNumber
- GetSortBehavior
- GetSortDirection
- ListContent
- ::ListObjects
- SetMZTitle
- SetSortBehavior
Download the zipped class -HERE-.
|