2,376

(10 replies, posted in General)

Hi Adam,
If that is all you are wanting to do, I'm not sure why you need to have a separate form at all.  Can you not just put your memo1, edit 1 and 2 buttons all on the same form?  It doesn't matter if they are doing fundamentally different things - they can happily co-exist.
If you want the visual effect of edit1 and the 'run' button appearing and disappearing, then simply make them invisible until called with an event attached to the 'Add Inputs' button.
Have a look at the attachment and see if that's the sort of thing you're after.
Derek.

2,377

(10 replies, posted in General)

Hello Adam,
I think there are two things that you need to look at.
1.   In your script, you are calling 'form2.show'  from the form1_button1_onclick procedure but you have attached the form1_button1_onclick procedure to form1 itself (form1_onclick).  As far as I know, this can only happen if you have copied it from somewhere else and pasted it to the wrong object/event.
2..  You have a 'new record' action attached to form1.button1.  I don't understand why you would want a 'new record' action AND a script event to both call form2.
Derek.

2,378

(32 replies, posted in General)

Hello Adam,
If you have defined your fields as 'not null', then standard MVD will check that something has been entered into those fields - but 0 is allowed (and may well be valid).
However, what you could do in Form1 of your example, is to untick the 'currency' object property for your two currency fields (see attached screen shot) so that when you run the application, all 4 fields (2 currency, 1 real and 1 integer) display as blank;  at least then the User has to make the conscious decision to enter a value of 0 (rather than it defaulting  to 0 as it does when the 'currency' property is left ticked).  It is perhaps a bit less rigorous than the error checking that Mathias suggested to you but it can be done quickly and with no scripting.
To my knowledge, the message "This field is required......" that you get when a field has been left blank, is a standard message that cannot be amended.  It is 'switched on' when you configure the 'save' button on your forms.
Derek.

2,379

(32 replies, posted in General)

Hi Mathias
LOL! - yes, I noticed a spelling mistake so I delete and reposted!
Yes, for me 'minimalist' = EASY!! and less mistakes for me to make.
Derek.

2,380

(32 replies, posted in General)

Hello Adam, Hello Mathias,
I was just having a look at your project and there are a couple of points (and if you know this already, just ignore me - ha ha!).
You need to understand that calculated fields are not actual fields that are stored in tables - have a look at screenshot 1.jpg in the attachment .  Calculated fields are just empty containers that temporarily store the result of calculations based on actual fields in the table.  This is why, in your very first attempt, the calculation was not being done - you have no 'save' button so no actual fields are being written to the table and therefore, if you don't have any actual fields written to the table, there is no data to perform the calculation on.
If you understand this, you see that with Mathias' solution (which works perfectly) you don't need a table defined at all.  It uses the edit fields from Form1 to input values, then performs calculations solely within the script and then outputs the result back to Form1.
Maybe you'll find the attachment of interest - it takes another approach and actually saves your input fields to the table and, because it then has some actual data to use, can perform the formulae defined in your calculated fields and can then display the result back to you.
It doesn't matter which approach you use but maybe seeing the two helps you to better understand the advantages and disadvantages of calculated fields against doing calculations in a script.
Derek.

2,381

(4 replies, posted in General)

Hi AD1408,
I think this might be what you need (see attachment).
I've also added the 'vertical scroll bar' property to the memo1 object in the example - I normally find that I need it as this is the way that I set up my help files.
Regards,
Derek.

2,382

(6 replies, posted in General)

Hello AD1408,
I don't believe it is a version issue (I am using 2.5 but went all the way back to 2.1 just to be on the safe side and it still works okay for me).
The copy and paste you've done is fine so the only thing I can think of is that the directory and/or file name that you entered (zztemp\test.txt) does not exist at your end, in which case when you click it will simply do nothing.
Derek.

2,383

(6 replies, posted in General)

Hi  AD1408,
Quite a few ways but I find the easiest (and therefore always the best for me!!) is, in your script,  'openfile' + location + filename. 
For example -
procedure Form1_Label1_OnClick (Sender: string);
begin
  openfile('C:\Documents and Settings\user\Desktop\M.V.D\ad1408filelink\images\DSC01781.jpg');
end;
Depending on the file extension, it will open whatever type of file it is with your default program.
If you want it to link to the folder so the user can then pick a file, then write
procedure Form1_Label1_OnClick (Sender: string);
begin
  openfile('C:\Documents and Settings\user\Desktop\M.V.D\ad1408filelink\images\');
end;
Derek.

2,384

(27 replies, posted in General)

Hi AD1408,
If you hide the Windows menu bar using a script, you need to reduce the depth of your form by a corresponding amount (even if it appears to be reducing the height of your panel;  when you execute it, it should then look okay).  Alternatively, you can change the form's object properties (Additional / BorderIcons / Borderstyle = BSDialogue).
I think your weblink should be attached to a 'double-click' event rather than a 'single-click' event.  Alternatively, attach the URL instruction directly to the button.
See attached.
Derek

2,385

(2 replies, posted in General)

Hi,
"4. On this I feel stupid for not been able to correct it. I get  "no such column:SaleInvItem.total_cost" on run"
I think the error message can be a bit misleading. 
With calculated fields, you cannot use another calculated field as part of the formula (and, by the same logic, you cannot use a calculated field that references itself in the calculation).
The problem is because you have a calculated field with the following formula:  SaleInvItem.unit_cost * SaleInvItem.total_cost.   I think what you want is SaleInv.inv_net_total + SaleInv.tax_total.
Derek.

2,386

(27 replies, posted in General)

Hi AD1408,
1.  Attached is your project to which I have added a lookups table and form.  Now on the lookups for customer title, customer group, customer status, customer bleeper etc, you should see how this is working all off only one table.  Please note that I have not changed any of your existing table structure as there is too much in there and I would just be introducing errors in making such large changes.  Maybe now you can see how it works and how it can be quicker and easier to create (for your project, 1 table instead of 26 and just 1 form instead of 26 (or using many page controls).
2.  In order to give you an idea of menus, one simple way was to change the 'style' of the page controls that you use from 'tab' to 'menu' (it is an object property of the page control).  I have then added some extra buttons to call other forms;  so you have a mixture of page control and button but it all looks the same.  But there are quite a few ways of setting out menus - it really is which works best for your project.
3.  I have added what I think is the easiest way to create a help file.  Click on the User Guide/Help button and you will see that it is simply one very big label in which you can add all the help information that you need).  Again, there are lots of different ways, but this is, I think, very simple.
Derek.

2,387

(27 replies, posted in General)

Hi AD1408,
The screen capture about grid totalling should have been part of the attachment in the previous post (totals in tablegrid.jpg).   Here it is again, just in case.
Derek.

2,388

(27 replies, posted in General)

Hello Again AD1408, Jean,

With regard to your question (1. How do I calculate totals of a table grid?), please find attached the script you need.
However, unless you have a specific reason for using edit fields for your grid totals,  it is probably more efficient and certainly easier just to use the grid totalling options that you get with standard MVD.  The attached screenshot shows you where to find them and how to do it.

If I have some time, I will try and re-work a bit of your project to show you the approach to lookups with just one table that I use.  I can also include the way I create a 'help file' and a simple 'menu structure' that I often use, if that would be of any interest to you.

Derek.

Hello Again AD1408,  Hello JB
Please find attached a simple project.  This is the way I do my splash screens (easy and quick!).
In this example, I have 1 splash screen at  the start of the application and 1 when the application closes but you can actually have as many as you want at the start and at the end  (when 1 splash screen closes, then call another and another ......... and so on).
Hope this helps.
Derek.

2,390

(27 replies, posted in General)

Hi AD1408,
A simple demo is attached for you.  For example, I want to create a project with information about people. 
It has 3 lookups (but obviously it can be many more) for 1.eye colour, 2. height and 3. zodiac sign.
Using my attached project, these are the stages you must follow;

screenshot1.jpg
1.  create a table ('people')
2.  create a table ('lookups') with 2 fields ('lookupkey' and 'lookupvalue').
3.  create 3 relationships from the 'lookups' table to the 'people' table (1 relationship for each lookup) .
4.  create 3 calculated fields to retrieve the 'lookupvalue' field (1 calculated field for each lookupvalue).

5.  create your forms (form3 and form4 are for the lookups - you will only ever need these 2 forms even if you add 100 more lookups!).

screenshot2.jpg
6.  set the foreignkey and fieldname properties of each combobox and add the filter property

screenshot3.jpg
7.  add data to your 'lookups' table

screenshot4.jpg
8.  when adding data to the 'people' table, your comboboxes should retrieve the correct lookupvalues.

Usually, this would require 4 tables and 6 forms;  this way, it requires only 2 tables and 4 forms.

I am not sure what you mean when you write "I have too many lookup items to put in one list....".  Remember than when you add the filter to the combobox property, you are, in effect, creating sub-lists that would contain the same number of rows as doing it the usual way.

Hope this helps,

Derek.

2,391

(27 replies, posted in General)

Hello AD1408,
Apologies if I'm misunderstanding your question, but maybe the method I use for look-ups will be of interest to you.
I do all my lookups with a single table (to hold my look-up keys and values) and a single form that I use both to display and maintain the look-ups;  it has saved me so much time.
It's probably easier to attach a sample project to show you (in this example, I have 9 'look-ups' all created and maintained using just one form). 
The things to look out for particularly are:
1.  the multiple relationships created in the data structure pointing to the attributes table
2.  the calculated fields to show a text value rather than a record-id
3.  the use of the combobox filter property (so it shows just the rows that match your key)
As you can see from the attachment, all this is achieved using standard MVD and no script.  Also, if your project changes and you need to add new look-ups, the structure is already in place so you are future-proofed.
Depending on your project or number of users, you might want to password protect access to the look-ups maintenance but that is easy enough.
Hope this helps or at least gives you some ideas.  Please get back to me if you have any questions.
Derek.

Hello Eric,
Any chance you can zip up your project (without the .exe file) and attach it? 
Then someone in the Forum will be able to look at it and point you in the right direction.   
There are a number of 'standard' things you need to do when creating even basic projects and it's easy to forget a couple of them when you are new to MVD (we've all done it, so you are in good company!).
Derek.

2,393

(4 replies, posted in General)

Hi Dmitry,
That works great now and a much simpler way to display a logo screen rather than using ttimer etc.
Thanks,
Derek.

2,394

(4 replies, posted in General)

Hello Iacovlogica, Dmitry,
Thank you for your reply. 
However, my question to Dmitry is WHY can you call a form and use the 'sleep' function to display it for x seconds BUT any objects on that form are NOT shown. 
If
  logo.show;
  sleep(5000);
  logo.close;
is syntactically correct and the form is successfully opened, displayed for the correct time and then closed, I would expect any objects placed on that form to also be displayed, unless there is perhaps a bug.
Derek.

2,395

(4 replies, posted in General)

Hello Dmitry,
I hope you are well.
I am trying to display a 'logo' screen for a few seconds at the start of a project.  I know how to do this using the timer function but this has always seemed a complicated way of doing something that should be quite simple.
So I am trying to use the 'sleep' function.  This correctly displays my 'logo' screen and then closes after x seconds but any object that I have placed on the 'logo' screen (label, image etc) does not appear - all that displays is the blank 'logo' screen.  Is this a bug or is there something else I need to do?
Please find attached an example of my problem.
Thanks,
Derek.

2,396

(8 replies, posted in Script)

Hi,
One way to do it would be to save the 'copy / create' record and then select, one at a time, from a second tablegrid, the phone numbers you also want to 'copy / create'.   I've attached an example of how I might do it, but I imagine there are other ways too.
Another option might be to use the 'go multiselect' option on the tablegrid that contains the phone numbers.  I've used 'go multiselect' to delete multiple rows so I can't see any reason why it wouldn't work with inserts, although I've not tried it.
Derek.

2,397

(8 replies, posted in Script)

Hello,
Yes, you can get the values for comboboxes in your script in the same way as for edit fields.  I have attached your example (with the 'teams' relationship) showing this.
Hope it helps.
Derek.

2,398

(8 replies, posted in Script)

Hello V_Pozidis,

I do something similar where a new record is created based on an existing record with only one or two small changes (a copy/create).  Basically,
1)  the user selects an existing row in the tablegrid that he wants to use as a basis for the copy/create
2)  clicks 'copy'
3)  the chosen row is displayed (read only) so the user can verify the correct row is being used as the basis for the copy/create
4)  any changes are made as required
5)  click 'save'  and the new row is created.
I have attached a simplified version of my project for you to see it working.  Maybe this will help you.
Derek.

2,399

(11 replies, posted in SQL queries)

Hi EHWagner,
I've also noticed this sort of behaviour in odd circumstances (though not in sqlquery).
I know it's not a solution, as such, but as a work-around (and apologies if you've already tried it and it hasn't worked for you) is to make the field visible, set the TABSTOP checkbox to unchecked, reduce the visible size of the field and then hide it behind another element on the form.  It's always done the trick for me.
Derek.

2,400

(12 replies, posted in General)

Hi Gieri,
Yes, it also loses the footer caption when you do a 'search' on form1.tablegrid1. 
Maybe you can do it by script (perhaps something like   form1.tablegrid1.column[0].footer.caption := 'xxxxx'), but I haven't tried it.  As you said, I think it is a bug that should be fixed by Dmitry rather than us having to find a work-around..
When you use Office2010 header formatting, it adds a thin blue line above the form1.tablegrid footer - maybe that is all the Office2010 footer formatting that is avallable?
Anyway, glad it helped.
Derek.