26

(3 replies, posted in Talks about all)

Looks very snazzy

27

(1 replies, posted in Russian)

There is a

form1.Canvas.Rectangle(X1,Y1,X2,Y2)

28

(6 replies, posted in General)

Hmm, 2020 was a leap year, if you use 2024 do you get the same problem?

29

(5 replies, posted in FAQ)

Hi,

I assume you had the mySQL server running?

30

(6 replies, posted in General)

This error means you have entries in other tables linked to the entry you want to delete.

You need to delete those other entries first and then you can delete the master entry last.

31

(5 replies, posted in FAQ)

What browser and version are you using?

Could you post a picture of the error?

I might have misunderstood, but if Remainder_OnShow is your renamed Form1, you need to change

Возможно, я неправильно понял, но если Remainder_OnShow - это ваша переименованная форма Form1, вам нужно изменить

TTimer.Create(Form1)

To

TTimer.Create(Remainder_OnShow)

33

(3 replies, posted in General)

I don't think it is, because the Pascal script doesn't appear to have direct access to Windows Handles.

Hello Lejoso,


If you are updating a tablegrid you could do the following.

procedure dbUpdateTimer;
var
    indx,cnt : integer;
begin
  {updates any tablegrid no matter what its name onfrmMain}
  cnt := frmMain.ComponentCount -1;
  for indx := 0 to cnt do
  begin
    if frmMain.Components[indx]  is TdbStringGridEx then
        TdbStringGridEx(frmMain.Components[indx]).dbUpdate;
  end;    
{end of frmMain updates}

{manually update other forms}                                                                                          
  frmOrderEntry.grdOrder.dbUpdate;
  frmEditAssemblies.tgMasterPart.dbUpdate;
  frmEditAssemblies.tgSubPart.dbUpdate;
  frmEditPart.grdEditPart.dbUpdate;
{end of manual update other forms}
  //showmessage('databases updated');
end;

This code automatically updates all tablegrids in the program every 30 seconds or so. The timer is set up elsewhere.

If you don't want to do that, all you need to do is add the line

FormName.TableGridName.dbUpdate

in an event such as after_click  etc.

35

(8 replies, posted in Script)

Just a quick question, if you are wanting to save the image to the database, why aren't you using the dbImage component?

Using this would make your life much easier.

36

(12 replies, posted in General)

v_pozidis wrote:

A stupid question. What do you mean WAL???

I can answer your first question easily.  WAL stands for Write Ahead Logging, which allows SQLite to have multiusers access it.

However, these are special cache files that it writes, and won't automatically commit users data changes to the database. It basically will wait until the last user has closed their connection with the DB (with MVD that is just closing the application) and then it updates the database. I believe it commits data to the database as the cache reaches a certain point.


As for your other question, I'll have to think about it and maybe someone else can answer off the top of their head.

37

(12 replies, posted in General)

vanadu55,


You need to copy the following files to a folder on each client workstation in addition to your EXE file (Don't put them on the desktop).

1. Script folder containing just the dcu file.
2. Forms.xml .
3  sqlite3.dll .
4. Settings.ini
5. Any graphics.dll  if it exists +  image files if they exist.


Now you can either manually change the server path  to the database in the settings.ini file or install on one PC, run the program and then follow the dialogue prompts when your program can't find the database.  Once you have one settings.ini file set up, you can just copy that one to each PC.


Once that is done then you can place a shortcut on the desktops if you so wish.

38

(12 replies, posted in General)

You could try putting SQLite into 'WAL' mode, this might help.


Just a warning, if you intend to have the SQlite database file on a network share drive and an IT department runs a cache clearing program in the background, you will lose data and get locked database messages.


If there is no cache clearing program is running, then there shouldn't be any problems.

To enable WAL mode in sqlite, open your database in a database browser such as DB Browser for SQL Lite and type in under the SQL tab

PRAGMA journal_mode = WAL

Close the browser and when you next open your program you will see 3 extra files appear, these are the caching files.

If this doesn't work for you, then to disable Write Ahead Logging open the DB browser and type into the SQL tab


PRAGMA journal_mode=DELETE

39

(4 replies, posted in General)

Do you want the combobox to be hard coded or get the values from a table?


To hard code use this for example:

procedure frmRelationship_OnShow (Sender: TObject; Action: string);

begin
  

    frmRelationship.cmbRelationship.Items.Add('Sister');
    frmRelationship.cmbRelationship.Items.Add('Brother');
  
end;

Change frmRelationship  to your form name.


Change cmbRelationship to your combobox name.

40

(12 replies, posted in General)

Are you using SQLite or MySQL?

41

(0 replies, posted in General)

I'm unsure if this is expected behaviour, but I decided to change an existing table from a DATE field type to a DATE/TIME one.


This causes the table to be deleted in the database and a table labelled  table_name_tmp1 to be created which of course is empty.  Now this table does contain calculated fields and foreign keys and I wonder if that is why MVD is behaving as it is.

Another table that I made the same alteration to in the same database, accepts the alteration without deleting the table.


Is this expected behaviour by MVD?

Obviously SQLite itself doesn't know about date types and considers them to be text, so I think it strange that MVD should do what it appears to be doing.

42

(3 replies, posted in FAQ)

Thanks EHWagner,


Your code is far more compact than what I was about to write. Though mine was going to include buttons that could be acted upon.

43

(1 replies, posted in Russian)

Assuming the file link is not in a database and you just want to click on a button to open a file or folder, try


var
  fName :string;
 dir : TOpenDialog;

begin

    dir := TOpenDialog.Create(nil); {Creates and instance of TOpenDialog using dir as the variable}

    try
        
        fName := dir.files;   {Get the file name that is selected in the Open Dialog form}
        
        OpenFile(fName);  {This will open the file with whatever the default program is for the file}
     finally
      dir.Free;    {Free all the resources.
      
end;

There are many other options that can be used with both TOpenDialog and OpenFile. For example you can set a default folder to search, or a filter to only search for certain file types.  You can also if needed allow multiple selecting of files, but as the code above stands, the OpenFile function wouldn't work then.


Предполагая, что ссылка на файл отсутствует в базе данных, и вы просто хотите нажать кнопку, чтобы открыть файл или папку, попробуйте.


Есть много других опций, которые можно использовать как с TOpenDialog, так и с OpenFile. Например, вы можете установить папку по умолчанию для поиска или фильтр для поиска только определенных типов файлов. Вы также можете, если необходимо, разрешить множественный выбор файлов, но, как показывает приведенный выше код, функция OpenFile тогда не будет работать.

44

(2 replies, posted in General)

Hi Derek,


What you have suggested was my original idea, and then I thought I'd use the MessageDlgTimeOut  function, which would have been perfect if I hadn't discovered it doesn't return the 'flags' value (http://myvisualdatabase.com/forum/viewt … 199#p40199) .


I'll see how my current incarnation goes using the above function to close the program, and if it turns out the users are even more incapable in using a logout button than just closing the program, I'll institute my own close program timer with code similar to yours.


Thank you for the reply.

I have had to instigate a logout button in my little program and it struck me that when someone has logged out, it  would be a nice touch to allow them to log in again in case they had hit the logout button accidently.


The built in login form can be re-introduced by

frmDBCoreLogin.Show or ShowModal

, however as the main form is still open the login form is not able to work.


Apart from building my own login form, can anyone out there in MVD land think of a way to press the inbuilt login form into service to allow a relogin in?

46

(3 replies, posted in FAQ)

MessageDlgTimeOut(msg,caption,flags, milliseconds).

I think this function is missing an integer return!


As it stands, the buttons that are displayed cannot be interrogated, which makes displaying them pointless.

I have discovered that 'flags' is actually the button type constants to be displayed =.

0 =  OK
1 =  OK, CANCEL
2 =  ABORT, RETRY, CANCEL
3 =  YES, NO, CANCEL
4 =  YES, NO
5 =   RETRY, CANCEL
6 =   CANCEL, TRY AGAIN, CONTINUE

It would also be nice to perhaps have the option of displaying no buttons, in which case the function becomes a timed dialog message box.

I'm using v6.5

47

(72 replies, posted in General)

#13  =  the ASCII instruction to return the printing position to the beginning of the typed line.  This is what was known as a Carriage Return when using typewriters, and for programming can be seen  abbreviated as CR  in some texts.


Remove them from the code and see the difference in text positioning.

48

(72 replies, posted in General)

unforgettable wrote:

Actually I want to add a button which reset table/tables which delete all records of table.


In that case you can use the above code for selecting individual records and below to delete all records from a table. The SQL is  :

if  btn  = mrCancel then
      Exit
   else
     begin
       SQLExecute('DELETE  *  FROM your_table_name');

49

(72 replies, posted in General)

Unforgettable,


I think to keep things simple you should have two buttons for delete. One for a selected table and the other for all tables.


Are you sure that you want to actually delete tables and not just records?  Deleting a table cannot be undone.



You could have a check box which decides which button is visible or have the check box select two different forms one for each type of deletion.


As far as displaying messages this is what I do to delete an entry in a table. Note this is not deleting table but you can use the idea.


procedure frmEditOrderQty_btnFrmAmendDeleteRecord_OnClick (Sender: TObject; var Cancel: boolean);
 var
 text : string;
 btn :integer;
begin
    
  //Make a message string - from edit boxes of item selected
   text := 'ORDER ITEM '+#13#13 + frmEditOrderQty.edtfrmAmendDescription.Text +'  x '+ frmEditOrderQty.edtNewQty.Text;

//First warning message with a cancel and OK button showing. Click cancel allows you to not delete in case of making a mistake.
   btn := messageDlg('CONFIRM DELETION OF '+text,mtWarning, mbCancel+mbOK, 0);


//What to do if Cancel is selected - exit out of the code and close the form (in this case).
   if  btn  = mrCancel then
      Exit
   else
     begin
       SQLExecute('DELETE FROM orders WHERE orders.id =  "'+ intToStr(frmMain.tgOrders.dbItemID) +'"');

//Information message advising the record has been deleted.
       ShowMessage(#13#13 + text + ' has been DELETED' );
       frmMain.tgOrders.dbupdate
      end;
 

  frmEditOrderQty.Close;

end;

The SQL code needed to delete a table is SQLExecute('DROP your_table_name IF EXISTS');


The SQL code to delete all tables is more complicated, you actually might be better off by just issuing a command to delete the complete database file.


I'd recommend having a copy of your database file while you experiment with deleting tables. Also the above code needs to be changed slightly if your tables have foreign keys in them.

50

(3 replies, posted in Russian)

Shilov,


You need to change your MySQL authentication method to 'standard'  as MVD can't work with  SHA256 authentication.


Вам необходимо изменить метод аутентификации MySQL на «стандартный», поскольку MVD не может работать с аутентификацией SHA256.



(Google translate).