Delphi and Visual M FAQ
=======================

Last edited : 29 october 1996



Q 1 : Can Delphi and Visual M work together ?
---------------------------------------------

Yes, and by combining a fast (true compiler), object oriented visual
RAD tool like Delphi in combination with a fast database like Open M,
you get double power.


Q 2 : Ok, How ?
---------------

Delphi works with components, VCL or others (like OCX).
The VisualM.OCX is working from version Visual M 7, and Delphi 2.01.
Previous versions can only work by using the DLL file.


You can make a component yourself in Delphi by using the DLL file of
Visual M : 

- copy visualm.vbx to visualm.dll for 16-bit Delphi 1.x
or
- copy visualm.ocx to visualm32.dll for 32-bit Delphi 2.0

(in the windows\system directory)

Then, you can create a new component in Delphi, or take the example
component M or the example that the company GlobalWare build.
This component really is just a interface to the dll file : you can
define in the components properties, event code or methods.

Again, the example from GlobalWare or the m component has all this build already
for you.


Once you took-created-got the component, you have to install it into
Delphi.


Q 3, How do i install it ?
-----------------------------------------

In Windows 95, Delphi 2.0 (32-bit) :

- Make sure you installed at least the thin Open M client on you pc
  and you have copied the file \windows\system\visualm.ocx to
  \windows\system\visualm32.dll

- Install the Delphi-Visual M component into the bin directory of Delphi
  (usally C:\Program Files\Borland\Delphi 2.0\Bin)
  Copy the .DCU and the .RES file (the .PAS file is the source code)
  You do not have to put them in the bin directory, you can also make
  a new directory for your components.

- Before doing anything in Delphi, it is always safe to make a copy
  of the file cmplib32.dcl, if anything goes wrong in the installing
  components, this file will contain your old state.
  (This is a general advice when installing any component in Delphi)

- Launch Delphi 2.0, got to the menu option 'Component', 'Install...'
  Click on the 'Add' button, then on the 'Browse' button,
  Click on the component :
  - Mengine.pas if you use the component from GLobalWare,
  - M.pas if you use my component
  Click on the 'Open' button, and on 'Ok' :

  Delphi will re-compile all the components on his component palet.

  Depending on the component, it will be installed in
  - a new tab called 'GlobalWare' for the GlobalWare component
  - the 'Data Access' tab for my component


Q 4 When recompiling the palet, Delphi returns with an error message
    and the whole palet is empty ???
--------------------------------------------------------------------

When compiling the M component fails, it usually means that Delphi did
not find the VisualM32.dll : make sure you copied it from the visualm.ocx
file, in the windows\system directory.
Copy the backup file of the Delphi components back to cmplib32.dcl.


Q 5 Everything is installed, but how do i actually use Visual M with
    Delphi ?
---------------------------------------------------------------------

Once the component is installed onto the component palet, you can double-
click it, so it will appear on your form.

You can change properties of the object at design time in the
object properties box, or in your Pascal code (properties and methods).


Q 6 Huh ?
---------

Ok, let's make an example :

Launch Delphi, and double click on the M component, so it will appear
on you form.

For the GlobalWare component, it is installed in the GlobalWare tab,
it will have a default name MEngine1.

For my component, it will be in the Data Access tab, and the default
name will be M1.

Put two edit boxes and a button on you form.

Double-click on the button, the Pascal editor will appear :

an empty procedure will be already there :

procedure TForm1.Button1Click(Sender : TObject);
begin

end;

Add some pascal code like this :

M1.Code := Edit1.Text;
M1.Execflag := 1;
Edit2.Text := M1.Value;

It will look like this :

procedure TForm1.Button1Click(Sender : TObject);
  begin
    M1.Code := Edit1.Text;
    M1.Execflag := 1;
    Edit2.Text := M1.Value;
  end;


Run the program (click on the green > button, or choose Run in the menu).

You can enter some M code in the first edit box (e.g. =$zv), and after
you click on the button, the return value will appear in the second
edit box.

Q 7  Which are the properties/methods that i can use in the already
     made components?
-------------------------------------------------------------------

From GlobalWare :
=================

properties :

Code
Name
NSpace
P0 .. P9
Tag
Timeout
Value

run-time properties :

Errorname
Errornumber

methods :

execute  (will execute the code, e.g. MEngine1.Execute;)

From myself :
=============
properties :

Execflag (currently only M1.Execflag := 1; same as M1.execute)
Code
NSpace
P0..P9
PDelim
PList
Tag
Timeout
Value

run-time properties :

Errorname
Errornumber

methods :

execute
run(m-code) (will do the same as setting first the code, and then the
             execute method, e.g. M1.Run('s P0=$ZV');


Q 8  Can i use the MDesktop from within Delphi ?
------------------------------------------------

No, it is only made for VB.


Q 9  Is there a way to speed-up my development in Delphi-Visual M ?
-------------------------------------------------------------------

Yes, you can create new components that inherit from existing ones,
and add m-aware functionality to it.

For example, you can create a new MEdit component which inherits from
the standard Edit component, but will also have a patternmatch property.
This property will contain valid M-pattern matching syntax and will
do the validation in M ...

Or, you can create a MCombobox or a MListbox who only need the property
nspace and Globalref to be filled in, and who already contain all the
logic of doing the $order or getting the data into the list...

I have an example of both objects, look for yourself, and create your
own M-aware tools !


------------------------------------------------------------------
If you have more questions on this, or want to download examples,
please contact :

Danny Wijnschenk
Sales Engineer Belgium
InterSystems

Tel. +32 16 53 76 82
fax. +32 16 53 52 75

email : Belgium@intersys.com

Enjoy Delphi and Visual M !

-------------------------------------------------------------------
