101

(2 replies, posted in General)

Hello v_pozidis

If I understand your question you want to create menus on a form other than Form1
Try this :

Create menus on a form other than the main form

procedure Form1_OnShow (Sender: string; Action: string); // event OnShow
var
   MyItem1: TMenuItem;
   MyItem2: TMenuItem;
   MySubItem3: TMenuItem;

   MenuForm2: TMainMenu;
begin


   MyItem1 := TMenuItem.Create (Form2);
   MyItem1.Caption := 'MyItem1';
   MyItem1.OnClick := @MenuClick1;

   MyItem2 := TMenuItem.Create (Form2);
   MyItem2.Caption := 'MyItem2';


   MySubItem3 := TMenuItem.Create (Form2);
   MySubItem3.Caption := 'Submenu';
   MySubItem3.OnClick := @MenuClick3;



   MenuForm2 := TMainMenu.Create(Form2); // Create MainMenu on Form2
   MenuForm2.Items.Add(MyItem1);         // you can use ADD or INSERT
   MenuForm2.Items.Insert(0, MyItem2);   // you can use ADD or INSERT
   MyItem2.Add(MySubItem3);

end;


procedure MenuClick1 (Sender: string);
begin
     ShowMessage('Hello from MyItem1');
end;

procedure MenuClick3 (Sender: string);
begin
     ShowMessage('Hello from Submenu');
end;

begin

end.


Other method :

procedure CreateMenu;
var  MainMenu:TMainMenu;
      Item:TMenuItem;
begin
  MainMenu:=TMainMenu.Create(Form3);
  Form3.Menu := MainMenu;
  Item:=TMenuItem.Create(Form3);
  Item.Caption := 'Bingo!';
  MainMenu.Items.Add(Item);
end;

begin
   CreateMenu;
end.

In this example, we create the main menu on Form3. This can be useful if your starting form is used for the login form.

JB

102

(9 replies, posted in Russian)

Hello Wladimir

On FormMainBook, with button "Новая книга" (iAdd a book) if i've well translated with google) the goal is to add a new book,
Why behind this button don't you call as Action 'New record' instead of Action 'Show Record'.
Because the form called shows last entry while the fields should be empty ?

Maybe I misunderstood the purpose of this button
JB

103

(8 replies, posted in General)

Hello StateOne

Is it this soft /

https://www.softpedia.com/get/Multimedi … QRes.shtml

JB

104

(2 replies, posted in Script)

Hello Tcoton

I used this code with RAD XE3 with success.

function TForm1.GetCurrentUserName: string;
const
  cnMaxUserNameLen = 254;
var
  sUserName: string;
  dwUserNameLen: DWORD;
begin
  dwUserNameLen := cnMaxUserNameLen - 1;
  SetLength(sUserName, cnMaxUserNameLen);
  GetUserName(PChar(sUserName), dwUserNameLen);
  SetLength(sUserName, dwUserNameLen);
  Result := sUserName;
end;

and to retrieve user's name :

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(GetCurrentUserName);
end;

I have not yet tested under MVD

JB

105

(6 replies, posted in General)

Hello Nikomax, Hello Derek, how are you ith this strange weather ?

Niko,lpour utiliser cette instruction, tu vas dans l'Inspecteur d'Objets (sur la gauche), tu cliques sur Events (Evènements).
Ensuite depuis la liste d'évènements possibles, tu double cliques sur le premier (ONClick).
Et danslapage de scripts qui va s'ouvrir en te présentant cet évènement, tu colles l'instruction que je t'ai communiqué plus haut.
Cela donnera :

procedure Form1_Button1_OnClick (Sender: TObject);
begin
    OpenFile('Covers');           // On accède au fichier des couvertures
end;

Reviens vers nous si tu rencontres des problèmes.
Dans tous les cas les solutions proposées par Derek sont toujours très efficaces.
En outre elles vont à l’essentiel, sans fioritures qui surchargeraient le code.

JB

106

(21 replies, posted in General)

Hello K245

Thank you for your work on the styles. It works without any problem and it adds a visual plus to applications developed with MVD.
May I translate the articles you publish on your blog in French?
Thanks
J.B.

107

(21 replies, posted in General)

Hello v-Pozidis

The link is at the bottom of this K245's article

in blue :Ссылки

    Проект “Хамелеон” с файлами стилей

JB

108

(6 replies, posted in General)

Hello Nicomax

Bienvenue dans MVD, un superbe programme de gestion de base de données

Pour ce faire, entrez cette instruction

A mettre derrière l'évènement OnClick d'un bouton :

OpenFile ('Z:\WIP\WIP.xls');

Dans ce cas, Excel se lancera et ouvrira le fichier WIP.xls

JB

109

(2 replies, posted in General)

Hello unforgettable

A proven MVD script:

procedure Form1_OnShow (Sender: string; Action: string);
begin
    Form1.GridEmployees.Font := LoadFont;
end;

procedure Form1_Button5_OnClick (Sender: string; var Cancel: boolean);
var    FontDialog: TFontDialog;
begin
    FontDialog := TFontDialog.Create(Form1);
    FontDialog.Font := Form1.GridEmployees.Font;
    if FontDialog.Execute then
    begin
        Form1.GridEmployees.Font:= FontDialog.Font;
        Form1.GridEmployees.dbUpdate;
        SaveFont(Form1.GridEmployees.Font);
    end;
end;

procedure SaveFont(Font: TFont);
var   reg: TRegistry;
begin
     reg := TRegistry.Create;
     reg.Access := KEY_ALL_ACCESS;
     reg.RootKey := HKEY_CURRENT_USER;

     if reg.OpenKey('software\YourProjectName', true) then
     begin
          Reg.WriteString('Font.Name', Font.Name);
          Reg.WriteInteger('Font.Size', Font.Size);
          Reg.WriteBool('Font.Style.fsBold', fsBold in [Font.Style]);
          Reg.WriteBool('Font.Style.fsItalic', fsItalic in [Font.Style]);
          Reg.WriteBool('Font.Style.fsUnderline', fsUnderline in [Font.Style]);
          Reg.WriteBool('Font.Style.fsStrikeOut', fsStrikeOut in [Font.Style]);
          reg.CloseKey;
     end;

     reg.Free;
end;


function LoadFont: TFont;
var   reg: TRegistry;
begin
     result := TFont.Create;
     reg := TRegistry.Create;
     reg.Access := KEY_ALL_ACCESS;
     reg.RootKey := HKEY_CURRENT_USER;

     if reg.OpenKey('software\YourProjectName', true) then
     begin
          if reg.ValueExists('Font.Name') then result.Name := Reg.ReadString('Font.Name');
          if reg.ValueExists('Font.Size') then result.Size := Reg.ReadInteger('Font.Size');

          if reg.ValueExists('Font.Style.fsBold') then
              if Reg.ReadBool('Font.Style.fsBold') then result.Style := result.Style + fsBold;
          if reg.ValueExists('Font.Style.fsItalic') then
              if Reg.ReadBool('Font.Style.fsItalic') then result.Style := result.Style + fsItalic;
          if reg.ValueExists('Font.Style.fsUnderline') then
              if Reg.ReadBool('Font.Style.fsUnderline') then result.Style := result.Style + fsUnderline;
          if reg.ValueExists('Font.Style.fsStrikeOut') then
              if Reg.ReadBool('Font.Style.fsStrikeOut') then result.Style := result.Style + fsStrikeOut;

          reg.CloseKey;
     end;

     reg.Free;
end;

JB

110

(1 replies, posted in General)

I have just completed a cooking recipe management application (MVD 6.6).
I would like to add a mass and volume conversion form (Kg to g, mg... and L to cl, ml into French), but I'm a little confused with the type of variable (double? single?).
I enter in a first Edit1 the mass to be converted (ex. 1 Kg) and via the Form1.Edit1.OnChange instruction, the conversion is available in each of the following EditBoxes.
Do you have an idea to do this? Would calculated fields be okay?
I searched the internet but couldn't find anything conclusive.
Thanks in advance.
J.B.

111

(11 replies, posted in General)

Hello krause, dbk, K245

Take a good look at the syntax proposed by dbk: remove 2 parentheses
all the messages are not translatable, they have not all been entered in MVD

JB

Hello 0anion0

Here is the code I use to display the different data on the right side of the screen.
If you have different tables but in relation to each other (relationship), you will have to use the Left Outer Join (SQL) statement to retrieve the different elements.
This is the best solution: create independent tables that have become relational.
By clicking on a cell of the grid, all the elements concerning a flower (this is my case in this example) will be brought together to form the right panel.
Similarly, if you use the arrows to navigate the grid, add this same code behind the OnKeyUp and OnKeyDown statements.

See in attachement, my code.
Hope this can help you.

JB

Hello Oanion0

Do you mean something like this ? (See this attachment)

JB

114

(8 replies, posted in General)

Hello lemodizon

Here is the definition given by Embarcadero (from which MVD was created (RAD XE3)):

The Data Dictionary


When you use the BDE to access your data, your application has access to the Data Dictionary. The Data Dictionary provides a customizable storage area, independent of your applications, where you can create extended field attribute sets that describe the content and appearance of data.

For example, if you frequently develop financial applications, you may create a number of specialized field attribute sets describing different display formats for currency. When you create datasets for your application at design time, rather than using the Object Inspector to set the currency fields in each dataset by hand, you can associate those fields with an extended field attribute set in the data dictionary. Using the data dictionary ensures a consistent data appearance within and across the applications you create.

In a client/server environment, the Data Dictionary can reside on a remote server for additional sharing of information.

To learn how to create extended field attribute sets from the Fields editor at design time, and how to associate them with fields throughout the datasets in your application, see Creating attribute sets for field components. To learn more about creating a data dictionary and extended field attributes with the SQL and Database Explorers, see their respective online help files.

A programming interface to the Data Dictionary is available in the drintf unit (located in the lib directory). This interface supplies the following methods:

This is supposed to improve searches in tables related to each other.
Honestly, in my MVD apps, I never check this option and I've never noticed any issues when querying among related tables.

Moreover, it is true that my applications developed with MVD do not use a remote server.

JB

115

(16 replies, posted in FAQ)

Hello John, Hi Derek

You have many ways to always get what you want (dixit Mixk Jagger)

Pour compter le nombre de lignes d'une grille

procedure Grille_OnShow (Sender: string; Action: string);
Var i : Integer;
begin
     Grille.TableGrid1.dbUpdate;
    i := Grille.TableGrid1.RowCount;
    Grille.Label1.Caption := 'Il y a ' + IntToStr(i) + ' fiches dans la table Biblio';
end;


Or

procedure Form1_TableGrid1_OnChange (Sender: string; ACol, ARow: Integer);
var s: string;
begin
s := IntToStr (SQLExecute('SELECT count(id) FROM base') );
Form1.Label1.Caption:= ' Total : ' + s;
end;

Or

procedure Form1_TableGrid1_OnChange (Sender: TObject);
begin
    Form1.Label1.Caption := IntToStr(Form1.TableGrid1.RowCount);
end;

JB

116

(16 replies, posted in FAQ)

Hello lemodizon, Hi Derek

The creator of MVD is Dmitry I. who lives in Bulgaria.
For some time now, he has been abandoning the further development of MVD (which is a shame, I hear voices shouting "Come back, Dmitry).
Currently, he is pursuing an apprenticeship aimed at developing applications on the Internet, with the use of new programming languages (Python).
It could be that if he doesn't get the results he's looking for, he'll come back to MVD again.

As for the idea of putting MVD in open source, it is unthinkable because of the third-party programs involved for which Dmitry paid licenses.

Of course, we can only wish for the further development of MVD with Dmitry in action.

JB

117

(2 replies, posted in General)

Hello lemodizon

Suppose there are text fields containing the product price (edCost) and quantity (EDQ), and we need to calculate the total (edTotal).

procedure CalculateTotal;
begin
    Form1.edTotal.Value := Form1.edCost.Value * Form1.edQ.Value;                  // We perform the calculation
end;

procedure Form1_edQ_OnChange (Sender: string);
begin
    CalculateTotal;
end;

procedure Form1_edCost_OnChange (Sender: string);
begin
    CalculateTotal;
end;


begin

end.

This can be a clue

JB

Hello Domebil, Hello Brian

MVD was coded from the RAD XE3 version of Embarcadero.
It will be difficult to open source MVD, as Brian says, because of the third-party programs used: Fastreport for reports, Bergsoft for grids, Google API permissions for maps.
The ideal solution would be for Dmitri to return to support MVD, which he created.

JB

119

(9 replies, posted in General)

Hello negadi37, Hello Brian

Tu peux également jeter un oeil sur ce lien :
https://www.experts-exchange.com/articl … -Word.html

Also have a look to this link :
https://www.experts-exchange.com/articl … -Word.html

JB

120

(9 replies, posted in General)

Hello negadi37
Try this :

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
     if ValidFloat(Form1.Edit1.Text) then
         Form1.Edit2.Text:=ToWords(Form1.Edit1.Value);
end;
JB

121

(7 replies, posted in General)

Hello Destiny

Un début de piste :
A start of the clue :

procedure TEditForm.CutToClipboard(Sender: TObject);
begin
   Editor.CutToClipboard;
end;
procedure TEditForm.CopyToClipboard(Sender: TObject);
begin
   Editor.CopyToClipboard;
end;
procedure TEditForm.PasteFromClipboard(Sender: TObject);
begin
   Editor.PasteFromClipboard;
end;

JB

122

(7 replies, posted in General)

Hello unforgettable, hello sparrow

it is an integer coded on 64-bit which is currently the maximum size in Delphi language (turbo pascal)
JB

123

(7 replies, posted in General)

Hello Derek, Hello unforgettable

StrToInt64 converts the string S to a Int64 value, and returns this value.
The string can only contain numerical characters, and optionally a minus sign as the first character. Whitespace is not allowed.

Hexadecimal values (starting with the $ character) are supported.
For example, IntegerString such as '123' into an Int64 return value.

It supports +ve and -ve numbers, and hexadecimal numbers, as prefixed by $ or 0x.

JB

124

(12 replies, posted in Script)

Hello mgoodman99

Sender is a reference to the component that fired the event. In this case, Sender is going to be the button the user clicked which called your Button1Click event.
This is useful when you have several components that call the same event and you need to figure out which component caused the event to be fired.

JB

125

(12 replies, posted in Script)

Hello mrgoodman99

And if you try this

form2.Checkbox1.Checked := not form2.Checkbox1.Checked;
form2.CheckBox2.Checked := not form2.Checkbox2.Checked;
form2.CheckBox3.Checked := not form2.Checkbox3.Checked;
form2.CheckBox4.Checked := not form2.Checkbox4.Checked;

JB