(1 replies, posted in Russian)

Посмотрите на эту ссылку от https://myvisualdatabase.com/forum/view … 416#p34416  (признательность Jean).
Другой вариант — использовать значки Unicode — см. вложение. Это имеет то преимущество, что не требует никаких скриптов, а также значки масштабируются по размеру при изменении размера кнопки.
Может быть, это поможет.
С уважением


(7 replies, posted in General)

As I understand from your project, all you want is to hold 3 levels of information:
House owners (Persone) who can have one or many properties (Immobili) and each property (Immobili) can have one or many partculars (immobili_UI).
This is pretty straightforward in MVD using 3 linked tablegrids.
The reason for your problems is because you are trying to use a tablegrid to filter data and display the filtered results in a treeview (filtering on treeviews as K245 wrote earlier, is conceptually very different).
Is there a reason why you need to mix tablegrids and treeviews rather than just using tablegrids?  (and at a practical level, I would think it's quite confusing for a user to have to enter data in both treeviews and tablegrids as the interface is quite different)


(6 replies, posted in General)

Hi StateOne, CDB, Sparrow,
Have a look at the attachment.
In the example, you can
1. left-click on a petrol pump to receive fuel (enter as a positive qty) or issue fuel (enter as a negative quantity).
2. right-click on a petrol pump to get a summary - and from here you can also click on the 'configuration' button to set up your pumps, stock levels, warning levels etc.
It's something my grandson was doing for a school project but I don't think he quite finished it (for example, there is no validation to test for over- or under-stocks).  But maybe you can use it as a basis for what you want.

In that case, simply use a 'header' table (with the 'counter') and then use another table to hold all the related line items.
Please see attached (I used one of my own templates as it was quicker to demonstrate but everything can be applied to your project / layout).
One other suggestion is to use just a single form to maintain your reference tables ('clients' and 'items'). In bigger projects where you might have many such reference tables or if your current project starts to grow,  it can be a big time-saver when developing it and your program will load faster.

I had a quick look at your project and, unless I'm missing something, I don't think you need to make it as complicated as you are doing.
Specifically, why do you need a separate table just for the 'editcounter' when it could simply go on the 'linkitems' table.
Have a look at the attachment.

Hi Salvatore,
Two things you need to do;
1.  make sure that your edit fields are set to %s% so that it immediately starts searching as you type.
2.  set the incremental search property for each of the search fields.
Please see the attachment.
And yes, you are correct, - it is standard MVD functionality.

At its simplest, try it something like this (see attached).
You do need to be careful that certain components (mainly the tablegrid) have focus at the time of pressing the required keyboard combinations (particularly if you have multiple tablegrids on the same form).

Not sure what you are needing.
Can you give more information, attach your project or a screenshot of what it is you trying to achieve.


(5 replies, posted in FAQ)

Hi Salvatore, Salut Jean (oui, tout va bien ici, merci.  Et chez toi ?),
In my previous example, the foreign key setting was left over from your original attachment - it didn't need to be there.  Instead, it should be set as per 'screenshot1' in the attachment.
To clarify, there are three things that you need to set correctly.
1.  In the data schema, the table that contains your treeview structure must have a field called 'parentid' (defined as integer).   
2.  The 'foreign key' in the 'treeview' settings screen can simply be the name of the table that holds the structure of your treeview (the 'foreign key' label is perhaps a bit misleading).  You can simply type in the name of the table manually. 
3.  Select 'parentid' in the 'parent id field (see 'screenshot1').
There is no requirement for a separate 'childrens table' - that is the whole point of using a 'treeview';  all of the 'child' records are held in the same table as their 'parent' and they are linked back to their relevant parent by the 'parentid' field. 
Have a look at 'screenshot2' in the attachment which hopefully clarifies this;  this is a view of the raw data (using SQLiteStudio) which shows, for example, that the entry 'Hollywood' has an ID of 19.  All of the records that are 'children' of 'Hollywood' have their own IDs BUT HAVE A PARENTID OF 19 - this is how the relationship is automatically maintained.
IF YOU WERE USING TABLEGRIDS, then you would have TWO TABLES (eg 'groups' and 'members' with a foreign key maintaining the relationship between them).  But with 'treeviews' all of the informaiton is held in A SINGLE TABLE with the relationship being maintained instead by a 'parentid';  this is the fundamental difference.


(5 replies, posted in FAQ)

There are a couple of things you need to understand with 'treeview' and its underlying data structure.
1.  at its simplest, you only need to have one table (for example 'my_structure').  In 'my_structure' you only need to typically have 2 fields - the name of the 'node' in the 'treeview' and a description of the node (the description isn't necessary but can be useful).
2.  when designing your 'treeview', there are two things to be aware of;
2.1  you need to make the 'treeview' editable (see the attached screenshot).
2.1  optionally, you need to specify a form where you enter information about each node (see the attached screenshot).  If you do not use a separate form (form2 in the attached example), you get the default option which only allows you to enter the node name and nothing else (which is okay if your requirement is very simple but limits you if you need to add additional information about the node).
3.  any additional related tables are not relevant to the structure itself but are simple look-up tables with values that add extra information to the node (in the attached example, the values of 'maschio' and 'femmina' (held in the 'seeso' table) would not be a new node in the structure, they are just information relating to a particular node in the structure.
It sounds far more complicated trying to descibe it than it actually is smile.  Have a look at the attachment and shout out if something is unclear.

Hi Salvatore,
A couple of suggestions to your attached project.
1.  using a separate tabsheet just to confirm that a record has been added / changed means you are having to write extra lines of code to make the tabsheet visible / invisible.  I would suggest using 'showmessage' or 'messagebox' to achieve the same thing more effectively.
2.  when you 'add' or 'edit' a record, you could use a common procedure (in the attached example, I've called it 'customer_maintenance') rather having repeated lines of code (it means if you need to change something, you only need to do it in one place - plus it's fewer lines of code anyway).
3.  in your example, if you went into the 'Project Area' tabsheet just to view, when you clicked on the 'Home' tabsheet, it left the 'Project Area' tabsheet visible so the form behaviour was inconsisent.
4.  I noticed that you described Tabsheet1 as 'HOME  LOL' - you can actually incorporate unicode icons as part of your labels anywhere in your project.
Have a look at the attachment - but as I said at the beginning, they are just suggestions so feel free to ignore them if they are not appropriate  big_smile


(7 replies, posted in FAQ)

Hi Salvatore, Hi Brian,
When developing your application, keeping track of a large number of tables and forms can be a bit time-consuming.
Brian has given you an option for 'tables'.
For 'forms', there are 2 things that might help
1.  click on the 'forms' tab (see the attached screen shot (many thanks to 'Eyeman' for the example) and they will all be listed in alphabetical order.  You can 'untick' them all to make your work area nice and clean and then simply click on the form you want to work with.
2.  you can also select a sub-set of the forms for the particular part of your program that you are working on by ticking them - they will then be available as discrete 'tabs' along the top of the work area (see attached screen shot).
As a general observation, it does concern me when other Forum members mention that they have 40-50 tables and many many forms.  It is unusual to have so many which makes me wonder if the data schema could perhaps be streamlined   The same is true for a large number of forms - could you make more use of editable grids (for maintaining 'lookup' tables for example), use page controls / tab sheets more or review the actual business 'process flow'.  As well as making it easier when developing your program, it will also load faster.

Have a look at the attached screen shot.
You can switch footers off completely, or you can do counts, sum, average etc etc (where relevant).  Additionally, you can add text before or after the calculation (ie £: or 'No' of Contacts:) etc etc
This is also where you can align (using the 'alignment tab') tablegrid headers and column contents.

Is this the sort of thing you need?  (see attached).
Another option for you could be to view a list of records (tablegrid) and add / edit / delete records on the same form - you don't always have to use a second form.


(54 replies, posted in General)

Ciao Fabio, Привіт Sparrow,
In answer to Question 1, this is because lines 253-254 in your script are switching off 'styles' for those particular forms.

//  frmItaliano.styleelements := 0;
//  frmStoria.styleelements := 0;

If you comment them out, they should appear as all the others.
With regard to Question 2, do you want to stop the user from closing the form before the effects finish or is this permissible and you want to avoid having to use task manager to terminate the program?  (for me, it does actually terminate but there is a delay of a few seconds).


(3 replies, posted in General)

Hi All,
From my understanding of what you've described, have a look at the attachment.
There are two options (one shows all regions at the same time, the other shows one region at a time depending on what has been selected).  In both instances, you can select the 'Top NN'.
This might not be exactly what you were after but maybe it helps with the syntax.

Any of the free tutorials you can find online for Pascal might be a starting point. 
Having said that, I find them a bit 'abstract' and you can spend time trying to work out exactly how they relate to the MVD environment.
Personally, I'd stick with this Forum and simply download various projects that others have uploaded and use them as a learning tool;  the basic syntax should soon become clear.
I also believe it's important that you don't try to 'run before you can walk'.  Rather than start off with a 'real' application that you want to write, it's probably better to take a step backwards and create a very simple 'play project' where you can try things out without worrying about messing things up and so build up your scripting knowledge gradually;  in my experience it will pay dividends in the long run.
And, of course, if / when you get stuck on something, post to the Forum and someone will invariably get back to you with solutions, options and advice.

You need to add a small script to pass through the ID of the organisation associated with the 'onshow' event of the 'location' form (please see attached).
This is not normally needed if you create 'organisation' records in a standard way (ie use a separate form rather than creating the 'organisation' record on Form1 (which can also cause potential problems with duplicate records)).


(9 replies, posted in General)

Please have a look at the attached screenshot.
Anything on a form in MVD is called an 'object'.; an 'object' can be a text box, a combobox, a tablegrid, the form itself etc etc.
Each 'object' can have a number of 'events' associated with it;  each of these 'events' can have a procedure written against it.
In your example, the 'object 'is the 'tablegrid' (gbu.tablegrid1) and the 'event' against which you want something to happen is 'OnCellClick;
What you need to do is to create an empty 'procedure' in which you can write some code and you can't just create this empty procedure by typing directly into the script. 
Instead, an empty procedure is created by selecting the 'event' (in this case 'OnCellClick' and then double-clicking. Once you've done this, go to the 'script' tab and you will see the empty procedure that has been created.
Note that if you double click on 'event', MVD will automatically create the empty procedure using a default name (a combination of the form name, the 'object' name and the 'event' name (in your example gbu_TableGrid1_OnCellClick).  However, you do not have to use the default 'procedure' name and can simply type in your own name and then double-click (and there are reasons when it is appropriate to do this).


(9 replies, posted in General)

So I'm guessing something like the attached.
I've reduced the number of forms but only to make it faster to enter data (mainly by putting the catalogue tablegrid on the 'main_add' form which saves you having to repeatedly open up and close a second form).
I've added search options for the tablegrids on 'main_show' and 'main_add' - once you've got more rows of data added, you're almost certain to need them.  In both cases, the searches are 'fuzzy' and look across all fields rather than the user having to work out which search field might relative to what).
Lastly, once the 'standard' catalogue entries have been copied to the 'main' table, they can then be manually changed, added to etc.
Hope this gets you progressing.


(9 replies, posted in General)

Thanks for the project - it makes things a bit clearer now.
Just a couple of questions before offering any suggestions;
1.  when creating or maintaining a 'main' record, once you select entries from the 'catalogue' table into your 'main' record, do you then ever make any manual adjustments to 'main_add.memo1' and 'main_add.memo2' or is it always exactly as copied from the 'catalogue' table (the reason for asking is that you don't have a relationship between the 'catalogue' and 'main' tables).
2.  does 'catalogue.field1' always get copied into 'main.cataolgue1' and 'catalogue.field2'. into 'main.catalogue2' or can 'catalogue.field1'. ever go into 'main.catalogue2' and vice versa?
3.  do 'main.catalogue1' and 'main.catalogue2' always get taken from the same row in the 'catalogue' table?  Or, for example, could you select the 'catalogue.field1' value from row 7 in the 'catalogue' table and the 'catalogue.field2' value from row 12 in the 'catalogue' table.  In other words, can you 'mix and match' or do 'catalogue.field1' values and 'catalogue.field2' values always come as pairs?
None of the above presents any problems to MVD, I just want to get a better understanding of how you see it working.


(9 replies, posted in General)

Welcome to MVD.
There are quite a few ways of doing what you've asked about.
Have a look at one option (see attached) that uses 'vanilla' MVD.  And within 'standard' MVD there are a number of variations on how to do this (and that's even before you (optionally) venture into writing bits of code).
In the attached example, simply enter a part no', a part description or a supplier (the 'search' feature is incremental) and the tablegrid displays matching rows.  Double click on the required row to fill in the relevant fields.
With any future questions, if you can include your project (delete the .exe file and then zip up the remaining files), it makes it a lot easier to give more focused suggestions.
Please note that MVD is no longer being actively developed although its feature set is rich and caters for most requirements. 
Support continues to be offered through the Forum.


(4 replies, posted in General)

Hi V_Pozidis, Привіт Sparrow,
The syntax is as follows:

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
  form1.edit2.text := sqlexecute('select lastname from test where name like "%'+form1.edit1.text+'%"');

But I think you are confusing 'sqlquery' with writing a procedure in a script.  'Sqlquery' will usually output to a tablegrid, not to a discrete edit field.
And I'm not sure what you are trying to achieve - what do you want to happen if you have more than one 'name' that is the same (ie Will Smith and Will Jones)?
It would make more sense, for example, to use 'Sqlquery' to output to a tablegrid all rows that have a 'name' of 'Will' and then highlight the specific row which then can fill in form1.edit2 with the 'lastname'.


(54 replies, posted in General)

Hi Again Fabio, Sparrow,
I was inspired by Sparrow's approach to simplifying 'frmitaliano' by using just one label and came up with yet another option (don't you just love MVD!).
1.  use one label with an initial width of 0. 
2.  increase the width of the label by the width of each letter. 
The only proviso here is that you really need to use a mono-spaced font to get the correct effect.  But the code is very simple.
Another random idea I had was that you could convert your grifone.png image into a .gif.
Both of these are in the attachment (I put them in a discrete project rather than mess up your 'Tesina' project).


(54 replies, posted in General)

Hi Fabio,
Basically, your version does work but you are calling from the wrong place.
This is the same issue that Sparrow identified and fixed for you earlier when you were trying to run the animation on frmringraziamenti
If you try and 'pull it' by using the standard 'onshow' event,  it runs the animation before actually showing frmitaliano;  you can tell this because of the delay (8 letters (I T A L I A N O x 400 milliseconds) ) between clicking the 'avanti' button and frmitaliano appearing.
Instead, you need to 'push it' from frmsommario.bavanti - that way, you can manually force frmitaliano to show before running the animation - look at the position of the instruction 'frmitaliano.show in the script (line 7 which is BEFORE the instructions to run the animation).
Hope that makes sense,
One other thing to note (it's not that important) but if you are running a lot of animations, you can usually just declare the counter (vi : integer) once at the start of your script as a 'global variable' rather than defining it as a 'local variable' within every procedure.