726

(8 replies, posted in Talks about all)

pavlenko.vladimir.v wrote:
vovka3003 wrote:

А вопрос задать нормально..?

вроди этой книги
https://programmera.ru/knigi_po_delphi/ … ncev-html/

только нашел ее, пока не читал, может в ней и будет то что мне нужно..

По этой ссылке указанная книга не открывается, зато на этом же сайте нашел интересную для себя книгу по мобильной разработке:

https://programmera.ru/knigi_po_delphi/ … onov-html/

Но, к сожалению, там ни слова о работе с внешними БД. Из чего у меня складывается впечатление, что такой возможности просто не существует, а взаимодействие с БД идет только через Web-API.

727

(8 replies, posted in General)

unforgettable wrote:

cascade check? It will enable to delete all foreign keys concerned date in all table having foreign keys?

Yes ))

728

(8 replies, posted in General)

When creating a connection, set a checker

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=8773&download=0

729

(8 replies, posted in General)

unforgettable wrote:

Thank you pavienko. Can you tell how to delete a data in foreign key?

Foreign key control is to prevent deletion of data referenced from other tables. This is an element of the data integrity control system.


If you need to delete a referencing reference record, there are three solutions in DVBM when setting up a foreign key:


1. Make the field optional. Then, before deleting the reference record, it is necessary to write the value NULL in such a field
2. Enable cascading deletion. Then, when a reference record is deleted, all records that had a connection with it will be deleted.
3. Before deleting an entry in the directory, delete all entries associated with a foreign key yourself.


What kind of removal method do you need?

730

(2 replies, posted in General)

SQL queries are SQL commands for retrieving or manipulating data.


A SQL script is a sequence of SQL commands that can be executed sequentially.


There is an extension of the SQL language - PSQL, which includes commands for creating variables, controlling the sequence of script execution, and more. This extension is used when writing stored procedures - scripts that are executed on the database server side.

731

(4 replies, posted in General)

rogrom wrote:

I resolve with this code, but is very slow, some idea to perform this script?

1) No need to call UpperCase() before each comparison, it's enough to do it when assigning a value to a variable.

tmpTag := UpperCase(Trim(Tags[i]));

2) Replace comparisons with lists.

var
  tmpList: TStringList;
...
  tmpList := TStringList.Create;
  tmpList.Add('SELECT');
  tmpList.Add('FROM');
  ...
  if tmpList.IndexOf( tmpTag ) >= 0 then
  begiin
  ...
  end;

This should not only improve performance, but also allow you to expand the dictionary without rewriting the code if you form a list from the base.


Try to avoid copy-paste when writing a program. Although this reduces the writing time, it leads to a decrease in the efficiency of the code and an increase in its volume.

732

(5 replies, posted in General)

identity wrote:

Hi
thank you domebil for your nice script and thank you Derek for your help
I know about page control / tab sheet functionality and used it in my form but the information that should be included are a lot more than a form and some page controls.
For example all the personal info should be included in one form
all the information regarding marriage and spouses should be included in another form
and finally all the information regarding children should be included in the third form
So I desperately need to combine 3 different forms together
Is there any way to connect them using scripts or buttons or etc?
thank you

It's possible to do it, but it's a bad idea. You will get confused in the conventions of the logic of work.

The point of the edit form is that it allows you to:

1. Prepare data for adding
2.1 Record prepared data or
2.2 Refuse to record data.

If you have several editing / adding forms for the same record in the database, then you will have to implement all the logic using scripts, without support from the MVDB components - there should be a handler on the "Save" canopy that will collect all the data from all forms of editing and will execute the required SQL query to add or update data. And every time you modify your forms, you will be forced to edit this script.

There must be a very good reason to make such an engineering decision. In my three years of development in the MVDB environment, I had no such reasons.

733

(4 replies, posted in General)

Yes it is possible. Use TdbRichEdit. I did the formatting and highlighting of the keywords that are recorded in the database with this script:

procedure frmImageEdit_TagTimer_OnTimer (Sender: TObject);
// обработка списка тегов в редакторе тегов
var
  i: integer;
  Tags: array of string;
  s: string;
  tmpTag: string;
  tmpETag: string;
begin
  TagTimer.Enabled := False; // оставновить таймер
  s := frmImageEdit.redTags.Text; // взять данные о тегах
  frmImageEdit.redTags.Clear; // очистить редактор
  // запятые заменить пробелами, убрать перевод строки и двойные пробелы
  s := ReplaceStr(s,',',' ');
  s := ReplaceStr(s,chr(13),' ');
  s := ReplaceStr(s,'  ',' ');
  Tags := SplitString( s,' '); // получить список тегов в виде строкового массива
  for i := 0 to length(Tags) - 1 do
  begin
    tmpTag := Trim(Tags[i]); // на всякий случай, чтобы остался только текст
    if (tmpTag <> '') then
    begin
      // ищем тег в базе
      tmpETag := VarToStr( SQLExecute('SELECT name FROM tag WHERE upper( name ) = upper("'+tmpTag+'")') );
      // если не найден, то
      if tmpETag = '' then
      begin // вставляем тег в написании пользователя, но с заглавной первой буквой, жёлтым цветом
        tmpTag := UpperCase(copy(tmpTag,1,1)) + copy(tmpTag,2,length(tmpTag)-1);
        frmImageEdit.redTags.InsertTextEx(tmpTag,$00FFFF,11,0,'Segoe UI')
      end // если найден, то вставляем в написании из базы, белым цветом
      else
        frmImageEdit.redTags.InsertTextEx(tmpETag,$FFFFFF,11,0,'Segoe UI');
     // добавляем пробел
     frmImageEdit.redTags.InsertTextEx(' ',$FFFFFF,11,0,'Segoe UI');
    end;
  end;
end;

The whole project is described here

734

(7 replies, posted in Script)

alecs175 wrote:

Интересное решение. То есть если использовать данный скрипт и Exel не нужен? Или данный скрипт для Exel предназначен.

Интересное решение - это писать вопросы на русском языке в англоязычной ветке форума, толком даже не разобравшись в сути топика и тематике форума wink 


The script is intended to be used inside My Visual Database.

735

(8 replies, posted in Script)

Hi eserjbrujo, unforgettable. I want to disappoint you: the need to copy data from one table to another indicates that the database structure does not comply with the principles of normalization. Don't waste time looking for problems that are rooted in the wrong architecture.

736

(1 replies, posted in General)

v_pozidis wrote:

How can I print in a report the value or the text from the Form1>>>> Form1.Label1.caption.


This can be done using a script, passing arbitrary parameters and their values to the report.


v_pozidis wrote:

Is there a way to make in  a report calculation from two records (a*b)??


This can be done using a script that needs to be placed inside the report. Each object on the report sheet has properties and the ability to write an event handler, such as loading data.

737

(11 replies, posted in General)

// локализация сообщения при авторизации.
procedure Login_OnClick( Sender:TObject; var Cancel:boolean );
// обработчик нажатия новой кнопки
var
  tmpMD5: string;
  tmpUsername: string;
  // так как у комбобокса нет имени, то найти его можно только полным перебором компонентов
  function GetCombo: TdbComboBox;
  //
  var
    i: integer;
  begin
    for i := 0 to frmdbCoreLogin.componentCount - 1 do
    begin
      if frmdbCoreLogin.Components[i] is TdbCombobox then
      begin
        Result := TdbCombobox( frmdbCoreLogin.Components[i] );
        exit;
      end;
    end;
  end;
begin
  // в зависимости от режима ввода логин находится в поле ввода
  if frmdbCoreLogin.edLogin.Visible then
    tmpUsername := frmdbCoreLogin.edLogin.Text
  else // или в выпадающем списке
    tmpUsername := GetCombo.Text;
  // вычисляем код, хранящийся в базе
  tmpMD5 := StrToMD5( frmdbCoreLogin.edPassword.Text + tmpUserName );
  // если соотвествующей записи в базе нет, то
  if SQLExecute('SELECT count(*) FROM _user WHERE username = "'+tmpUserName+'" AND password = "'+tmpMD5+'" ') = 0 then
    // выдаем наше локализованное сообщение
    // то, из-за чего весь сыр-бор и состоялся ))))
    MessageBox('Что-то пошло не так...','Ошибка', MB_ICONWARNING + MB_OK )
  else // если все нормально, то
  begin // нажимаем стандартную кнопку логина
   SendMessage( frmdbCoreLogin.bLogin.handle , wm_LButtonDown, 0, 0);
   sleep(100);
   SendMessage( frmdbCoreLogin.bLogin.handle , wm_LButtonUp, 0, 0);
 end;
end;

procedure Init;
var
  tmpLoginButton: TdbButton;
begin
  // создаем новую кнопу
  tmpLoginButton := TdbButton.Create( frmdbCoreLogin );
  tmpLoginButton.Parent := frmdbCoreLogin;
  // размещаем на месте стандартной
  tmpLoginButton.Top := frmdbCoreLogin.bLogin.Top;
  tmpLoginButton.Left := frmdbCoreLogin.bLogin.Left;
  tmpLoginButton.Width := frmdbCoreLogin.bLogin.Width;
  tmpLoginButton.Height := frmdbCoreLogin.bLogin.Height;
  tmpLoginButton.Caption := frmdbCoreLogin.bLogin.Caption;
  tmpLoginButton.Font := frmdbCoreLogin.bLogin.Font;
  // теперь новая кнопка будет срабатывать от Enter
  tmpLoginButton.Default := True;
  // назначаем обработчик
  tmpLoginButton.OnClick := 'Login_OnClick';
  // старую кнопку прячем
  frmdbCoreLogin.bLogin.Visible := False;
end;

begin
  Init;
end.

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=8747&amp;download=0


In Dutch it would be written like this:

...
MessageBox('Verkeerde naam/wachtwoord','Fout', MB_ICONWARNING + MB_OK )
...

738

(11 replies, posted in General)

Without Dmitry, you can only add a crutch.

https://avatars.githubusercontent.com/u/25460721?v=4

For example, on the authentication form, replace the button click handler, in which you can independently check the validity of the password / login and, in case of a problem, display a message in the desired language. And if everything is OK, then call the old handler.

Но, если подумать, то и на одинарный клик можно сделать то же самое:


procedure Form1_Memo1_OnClick (Sender: TObject);
var
  s: string;
  i: integer;
  StartPos, EndPos: integer;
begin
  s := Form1.Memo1.Lines[ Form1.Memo1.CaretPosY ];
  for i := Form1.Memo1.CaretPosX downto 1 do
  begin
    StartPos := i;
    if s[i] = ' ' then break;
  end;
  for i := StartPos + 1 to length(s) do
  begin
    EndPos := i;
    if s[i] = ' ' then break;
  end;
  s := Trim(Copy(s,StartPos,EndPos-StartPos+1));
  case s of
  'два': Form2.ShowModal;
  'три': Form3.ShowModal;
  end;
end;

Как это сделать по одинарному клику у меня идей нет, а вот по двойному - пожалуйста: размещаем на форме Memo и добавляем обработчик двойного клика:

procedure Form1_Memo1_OnDoubleClick (Sender: TObject);
var
  s: string;
begin
  s := Trim(Form1.Memo1.SelText);
  case s of
  'два': Form2.ShowModal;
  'три': Form3.ShowModal;
  end;
end;

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=8735&amp;download=0

К сожалению с RichEdit такой номер не прокатит, так как у него обработчик события двойного клика вызывается до того, как будет выделено слово.  Вообще у этого компонента огромный потенциал, но в MVDB он не раскрыт, в частности, нет возможности подключить событие на клик по URL, а это было бы очень круто.

Клик на текст вообще или на каждое слово в тексте - своя форма?

В settings.ini записываются настройки ширины колонок.

743

(1 replies, posted in General)

Just press the button:

http://www.thescangroup.com/images/help.jpg

744

(1 replies, posted in General)

To store and process any physical quantities, floating-point numbers (with double precision) are usually used.

I recommend storing data in the database itself in a standardized form, for example, in SI. This will prevent you from getting confused in the calculations.

And for the convenience of the user, provide the ability to recalculate in units convenient for him, both when entering data through the form (scripts), and when displaying in a tabular form (calculated fields).

I don’t have a ready-made recipe for implementation, it all depends on how you see it.

For example, in the database you can store the value itself (in kilograms), and the desired representation (link to the directory of representations - kilogram, gram, pound, etc.).

And in the view directory there are two fields: the name and the coefficient by which the value should be multiplied:
kilogram - 1
grams - 1000
pound - 2.2

You can also store the display precision (number of characters after busy) for a given view.

Then a table display can be done through a calculated field.

Or maybe you do not need to store the desired view for each record in the database, but store it in a global parameter, as a link to the view directory.

0anion0 wrote:

а можно ли установить программу для всех пользователей, {userappdata} это только для одного пользователя, да и HKCU тоже.

у меня не получается пока

скорей всего не получится, так как логика хранения файлов settings.ini и sqlite.db хардкорно прошита в приложении. Но можно дождаться ответа автора проекта )))

Но вы можете и не устанавливать программу, а запускать в портабельном режиме - из любой папки. Или сделать файл установки, который будет устанавливать программу вмесите с базой в свою папку. В таком варианте она будет доступна для всех пользователей.

746

(11 replies, posted in General)

k.krause wrote:

I want to translate the errormessage "Wrong username/password." I have several translations, but this I can not find. Does anybody know it?

Explain what exactly you need to clarify? The mechanism of localization of the given message?

Elementor хорош, но только платный )) Красиво получается, но сложно настраивать.

The problem is not Google, but RosKomNadzor. And yes, perhaps I will use the resources I have and create a site on WordPress. However, my eyes run wide when choosing a topic. I would really appreciate some advice on which WordPress theme to choose for my blog.


Проблема не в Гугле, а РосКомНадзоре. И да, пожалуй, я воспользуюсь имеющимися у меня ресурсами и создам сайт на WordPress. Однако у меня глаза разбегаются при выборе темы. Буду очень признателен за совет, какую тему WordPress выбрать для блога.

Владимир, благодарю! Я думал насчет своего сайта и WP, но пока не разобрался, как делать импорт-экспорт, чтобы переезд был с минимальными затратами. Впрочем, это для любого варианта актуально.

https://avatars.mds.yandex.net/get-zen_doc/241236/pub_5ad5ab121aa80c4380399ebe_5ad5ab2edcaf8ec3bc73214c/scale_1200


В России блокируются некоторые сервисы Google, из-за этого мои блоги о разработке программ в My Visual Database, созданные на платформе https://blogspot.com,  начали отображаться некорректно - не загружаются все изображения. Знаю, что можно включать VPN, но это не удобно, да и не у всех читателей он есть. В связи с этим хочу посоветоваться со своими читателями, где лучше размещать статьи на эту тему?