1 (edited by peacemaker 2019-06-22 04:19:07)

Topic: Couple of issues. Dropdown boxes not working and data not saving.

Hi guys, I have a couple of weird issue with my project.

1. The dropdown boxes are not working and will just show a blank box even though the required forms and database entries are correct.

2. The Tablegrid 2 is not saving if I close down MVD. It will save temporarily but the same data is shown on other "Learning titles". Once you close down MVD, the data is lost.
As you can see on the on tablegrid 1 (Learning report) it is saving  correctly.

3. The same goes for the "cost breakdown" button. The data entered is gone after closing MVD.

And do I need scripts so that the "total cost" is automatically calculated?

I'll really appreciate any help. Thanks again.

p.s. username and password is admin

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hello peacemaker

1 - How do you do to add a new type. Obviously, you use Form4 to enter a new type.
But on Form1, you have no way to to do it. I you add a button pointing towads Form4, you will se dropdow listbox with all values entered.
Same thing with RSOType

JB

3 (edited by derek 2019-06-20 17:22:53)

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hello Peacemaker,
I've just had a quick look at your project and I'd make the following comments.
1.  The dropdown boxes are working correctly but you have hidden form1.button1 and form1.button3 so no values have yet been entered for 'type' and 'rsotype'.
2.  Form2.button8 has been defined as 'showform'  Your 'rso' data is actually being saved but incompletely (rso. id_document is blank).  In other words, the 'rso' record doesn't know which 'document' record it is related to.  Use 'newrecord' instead of 'showform' and rso.id_document should get filled in correctly.
3.  The 'show cost breakdown' button has also been defined as 'showform' rather than 'newrecord' so, same problem as 2) above.
4.  I would use editable tablegrids on Form4 and Form5 - the way you have done it does work but makes it very easy to create both blank entries and duplicate entries.
5.  I am not sure why you are using a separate cost table if you have a fixed number of discrete fields (4) for 'food', 'supplies', 'transport' and 'expenses' - you might just as well delete the 'cost' table and hold them as discrete fields on the 'document' table which will simplify things.
6.  Whether you hold your costs in a 'cost' table or as part of the 'document' table, I would use a calculated field to get the 'totalcost' rather than store it which is data inefficient.
7.  Irrespective of where you hold your costs, they should be defined either as 'currency' or 'real', not 'text'.
8.  In your script, you are hiding frmlogin once the user has successfully logged in - this leaves the application running even when the user has logged off.
There may be other things - I've only had a few minutes to look.
Regards,
Derek.
..
..
Sorry Jean - only just seen your earlier reply.

4 (edited by peacemaker 2019-06-22 04:19:21)

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hi Derek,

Thank you so much.  I was able to fix most issues and thanks for the tips as well.


Only the cost breakdown is left. It is still not saving if I put it in the "cost" table.
I tried putting it in the document table with same result. I might be missing something?

May I ask how do I get the sum on the calculated field? is there a script for it?

The  login script is also provided by dimitry and it is also fixed.

Thanks again.

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hi,
In the suggested attachment, I've deleted the 'cost' table and hold your 4 different expense types in the 'document' table.
I also just show all the expenses (and then the calculated 'totalexpenses') in a panel rather than having to click a button to get the breakdown;  it's more straightforward.  It also means that you can delete the form 'frmcost' - the fewer forms you have, the quicker your application will load.
The 'totalexpenses' calculation for Form2 is in the script - it simply recalculates the 'totalexpenses' whenever the value of any of the 4 expense types changes.
Derek.

Post's attachments

Attachment icon Login.zip 891.14 kb, 301 downloads since 2019-06-21 

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hi Derek, it is beautiful and working perfectly.

May I ask one last thing. Do you know how to set the "Richedit" text on the left side of the database so that it defaults to text size 9 instead of 10?
Whenever I tried to add an entry it always defaults to size 10.

I really appreciate the help. Thanks again.

Re: Couple of issues. Dropdown boxes not working and data not saving.

You can change it using script

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
    Form1.RichEdit1.Style.TextStyles[0].FontName := 'Verdana';
    Form1.RichEdit1.Style.TextStyles[0].Size := 16;
    Form1.RichEdit1.Style.TextStyles[0].Color := clRed;
    Form1.RichEdit1.Style.TextStyles[0].Style := fsBold+fsItalic+fsUnderline;
    Form1.RichEdit1.ApplyTextStyle(0);
end;
Dmitry.

8 (edited by peacemaker 2019-06-22 06:55:08)

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hi,

It seems not to be working it says unidentified modifier?

I tried this script

    Form2.RichEdit1.Style.TextStyles[0].FontName := 'arial';
    Form2.RichEdit1.Style.TextStyles[0].Size := 9;
    Form2.RichEdit1.Style.TextStyles[0].Color := clblack;
    Form2.RichEdit1.Style.TextStyles[0].Style := fsBold+fsItalic+fsUnderline;
    Form2.RichEdit1.ApplyTextStyle(0);

The bold, italic and underline is working.
but I need it to be size 9 automatically. It is still showing as size 10.

I only need it to be size 10 and arial please.

Thank you.

9 (edited by derek 2019-06-22 11:43:28)

Re: Couple of issues. Dropdown boxes not working and data not saving.

Hi,
Please have a look at the attached - the script changes the default setting to be 'comic sans ms' for the fontname and '18' for the fontsize (I chose these 2 settings so I can easily see the difference! - just change the relevant lines in the script to what you need them to be).
I think there is a bit of understandable confusion because, when you are adding a NEW record, the default settings displayed in the Richedit toolbar still show as 'arial' and '10' (the original defaults). But if you just start typing, you will see that it is actually using the fontname and fontsize as specified in the script (when you edit a record, the display shows correctly).
If you always want it to be a specific fontname and specific fontsize, I guess you could set it in the script (as above) and remove the relevant toolbar from the richedit component to avoid any confusion.
Derek.

Post's attachments

Attachment icon Login.zip 890.64 kb, 320 downloads since 2019-06-22 

Re: Couple of issues. Dropdown boxes not working and data not saving.

thanks sir I understand it now. smile