If you plan to use the TListView component, I recommend reading about the properties and methods of the component and how to work with it.

procedure OnDblClick(Sender: TObject);
var
  i: integer;
  tli: TListItems;
begin
  tli := listview.items;
  for i:=0 to tli.count - 1 do
  begin
    if tli.item[i].selected then
    begin
      showmessage('Column0 - "'+tli.item[i].caption+'"');
      showmessage('Column1 - "'+tli.item[i].SubItems.Strings(0)+'"');
      showmessage('Column2 - "'+tli.item[i].SubItems.Strings(1)+'"');
      showmessage('Column3 - "'+tli.item[i].SubItems.Strings(2)+'"');
    end;
  end;
end;

Hi,
Something like this


procedure OnDblClick(Sender: TObject);
var
  i: integer;
  tli: TListItems;
begin
  tli := listview.items;
  for i:=0 to tli.count - 1 do
  begin
    if tli.item[i].selected then showmessage(tli.item[i].caption);
  end;
end;

begin
...
listview.OnDblClick := @OnDblClick;
end.

Hi Roberto


We kindly ask that in order to understand your problem, please indicate in the future exactly what errors occur.
When testing your program on my computer, you may get errors:
"Could not convert variant of type (UnicodeString) ..."
"Is not valid integer value..."
"Error message: no such column"

4

(8 replies, posted in General)

Procedures and functions, referred to collectively as routines, are self-contained statement blocks that can be called from different locations in a program. A function is a routine that returns a value when it executes. A procedure is a routine that does not return a value.

5

(3 replies, posted in Talks about all)

Try this

procedure Form1_Button7_OnClick (Sender: string; var Cancel: boolean);
begin

If InputBox('To continue, enter Admin Password!',  #0 + 'Enter Password:', '')='xray2024' then

    begin
      Form1.Button6.click;
    end else
    begin
      MessageDlg('Incorrect Password', mtError, mbOk, 0);
    end;
end;

///////  OR this ////////////

procedure Form1_Button7_OnClick (Sender: string; var Cancel: boolean);
var
  pasVal: string;
begin
  if InputQuery('To continue, enter Admin Password!', #0 + 'Enter Password:', pasVal)
    then if pasVal = 'xray2024' then MessageDlg('Correct Password', mtInformation , mbOk, 0) else MessageDlg('Incorrect Password', mtError, mbOk, 0);
  pasVal := '';
end;

Hi,


The code you provide does not copy anything. It allows you to select an entry in Combo4 if such an entry exists in it.
Sorry, but reading your messages on the forum I cannot understand what you want to achieve. Derek has already offered you several different solutions or, in other words, directions of movement. It may be worth considering them in more detail, or perhaps you should rethink your requirements and try simpler solutions, at least for now. Start with simple problems and simple solutions, this will allow you to understand the mechanism for solving problems, become familiar with the script and begin diving into databases. As you already understood, there is a lot of information and examples on the forum. Even if the example, as you think, is not yours, it is worth considering it in more detail. There will always be something new or unusual in terms of possible solutions, even in the simplest examples.

tcoton wrote:

You can delete the existing .def, it will be recreated using the new dll on your next project compilation.


I think you are confusing something about the "def" file? Maybe read it first?

8

(1 replies, posted in General)

Hi Jean


We can say that MVD includes a minimum set of mathematical functions from the mathematical library.
This set is quite enough to implement the most common, more complex functions.


Knowing the formula, you can always write your own calculation.


{ hypot function from AMath library (C) Copyright 2009-2013 Wolfgang Ehrhardt }
function hypot(x,y : float) : float;
  begin
    x:=abs(x);
    y:=abs(y);
    if (x>y) then
      hypot:=x*sqrt(1.0+sqr(y/x))
    else if (x>0.0) then
      hypot:=y*sqrt(1.0+sqr(x/y))
    else
      hypot:=y;
  end;

9

(8 replies, posted in General)

Hi all.


Derek,
Good job grandson).
Simple and great.
Especially the display of information using the right mouse button. I tried to correct it a little and you can get this result by right-clicking.


https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=10589

Destiny wrote:

What is the 'sqlite3.def' used for?


Hi,
In this case, it is not used in any way. Just ignore this file.

11

(8 replies, posted in General)

Hi all,


Since I called the topic “indicators,” I will post a new example of a circular indicator (percentage of completion) here too.

12

(8 replies, posted in General)

Something like this

13

(8 replies, posted in General)

The archive was created using 7zip. I also checked using WINRAR. I'm using version 6.xx.
The archive opens without problems. WINRAR recommends updating yourself in your case.

14

(8 replies, posted in General)

Hi all,

Several times on the forum questions appeared on the topic of various indicators for displaying information.
There are no built-in indicators.
This program is a demonstration of creating and using indicators (in this case circular ones) using MVD.
The script contains four procedures, each of which is responsible for its own indicator. All indicators work,
just some are slow (as intended). The first procedure can be called universal. The remaining three indicators
were created based on this procedure.
The procedure allows you to set the display angles of the scale, the range of scale values, scaling values, color
marks on the scale, change the direction of the scale reading and arrow movement, change the size of the
indicator, set the anchor point on the form, etc. . Knowing where to tweak, you can configure it more flexibly.
This procedure is already the second version. The first version was tied to user-created panels on the form.
On the one hand, this made it easier to place and link to a place, on the other hand, it did not allow indicators
to be partially superimposed on other elements or fit into figured places on the form.
If anyone finds it useful, I will be glad. Errors may occur.
Something like this.

15

(4 replies, posted in Russian)

к этому скрипту добавьте

  if frmLogin.MySQLConnection.Connected then
  begin
    UpdateDatabase('');
  end; 

16

(2 replies, posted in General)

Hi,



There are two options for displaying the balance amount or Edit1.
1. In the Edit1 properties, clear the TableName and FieldName fields. Go to the properties of Button5 (Report). Add Edit1 to the list of components participating in the search. You should have TableGrid1 and Edit1 in the list. Let's launch the program. Let's go to the report designer. In the right window, behind the “Data” tab, click on the “Variables” tab. In the list we see the Edit1 component. Drag it to the desired place in the report.
This is all.
2. We calculate the balance amount directly in the report.
Add Band ColumnFooter. Add a Memo to it with the formula

[SUM(<Report."tenucompte.entree">,DetailData1)-SUM(<Report."tenucompte.Depense">,DetailData1)] 

This is all.


But be careful. You may get different results with the first method if you select one row and run the report. You will see your row highlighted and the balance amount will reflect the amount for all records in the table.

Hi,

Your code is not working.


Something like this.


procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
  JArray : TJsonArray  ;
  i         : Integer     ;
  TStrL     : TStringList;
  js_name   : string ;
  js_color  : string ;
  str       : string = '[{"Name": "Cat","Color": "White"},{"Name": "Ant","Color": "Red"},{"Name": "Zebar","Color": "Black"}]';
begin
  TStrL := TStringList.Create;
  TStrL.Sorted := true;
  JArray := TJSONarray(TJsonObject.ParseJSONValue(str));
  for i := 0 to JArray.Size -1 do
  begin
    js_name := TjsonObject(JArray.Get(i)).GetPairByName('Name').JsonValue.ToString;
    js_color := TjsonObject(JArray.Get(i)).GetPairByName('Color').JsonValue.ToString;
    TStrL.add(js_name+','+js_color);
  end;
  frm_main.Memo1.Lines.Text := TStrL.text;
  TStrL.Free;
end;

18

(8 replies, posted in General)

Double-clicking on data, if there is a function (button) to edit a record, triggers the OnClick event for the edit button.

19

(8 replies, posted in General)

You are using the "Table.Hide" command inappropriately.
This command hides the form. And while the form is not closed, your main form is blocked.


To close the form, use only "Table.Close ;"
In your example, it is enough to delete the "Table.Hide" command.

20

(8 replies, posted in General)

Example

21

(8 replies, posted in General)

Hi Destiny


procedure Hide - Hides the form.
procedure Close - Closes the form.

event  OnClose - Occurs when the form closes.


Thus, by executing "Hide" you hide the form but do not complete its operation.
Because of this, the main form cannot be closed until the "Table" form is closed.
The "OnClose" event is executed when the form is closed (Close procedure) and is not executed in your case.

It's not entirely clear what you want to achieve?
Decide on your goal.
It all depends on your task.
1 For example, fields that need to be cleared constantly may have a different name, even with numbers.
You can search by the initial letters of the name on the form and clear them. For example ClrEdit2, ClrEdit11.
2 You can assign a unique TAG to such EDITs and then access them by searching for the value in the TAG.
3 If you want to use a parity check, select for such Edits, for example, the range Edit21...Edit39. Take the name, read 2 characters from the end, convert to an integer, check parity and clear.
But is all this worth replacing 10 lines of code Edit1.clear...Edit10.clear.
If you want to reduce the number of lines in the script, write this:

Form1.Edit1.Clear; Form1.Edit2.Clear; Form1.Edit3.Clear; Form1.Edit4.Clear; Form1.Edit5.Clear;
Form1.Edit6.Clear; Form1.Edit7.Clear; Form1.Edit8.Clear; Form1.Edit9.Clear; Form1.Edit10.Clear;

This is also possible and only two lines.

23

(7 replies, posted in Reports)

Hi all,

Something like this

24

(13 replies, posted in FAQ)

form1.PageControl1.Pages[1].TabVisible := False;

OR

form1.TabSheet2.TabVisible := false;

25

(7 replies, posted in FAQ)

Hi all

3 FREE usefull tools
https://myvisualdatabase.com/forum/view … hp?id=1122