276

(13 replies, posted in General)

I'm not an expert on the task scheduler, but I think you can hide schedules. You may need to read up on the security features.


Otherwise, I'm not sure what you can do. To my knowledge, MVD is not going to be able to do it within itself.

277

(13 replies, posted in General)

You should use Windows Task Scheduler for this.

278

(5 replies, posted in Script)

Derek,
I'm not aware of any such animal. It would be nice to have. The other option would be to use TColorDialog instead of a combobox. Just a thought.

279

(5 replies, posted in Script)

Derek,
See attached. I know it is not exactly what you are looking for, but it is a workaround using both the hex value and the color dropdown. It also will work with the corresponding ascii value in place of the hex value.

280

(2 replies, posted in Script)

Welcome to MVD.  See if the attached is what you are looking for. Only one RFID entry is in the Login table.  The entry is "test".  If you want to hide the RFID entry, you will need to put in a password character in the object inspector for the RFID edit field. Hope this helps.

281

(2 replies, posted in General)

Make sure you include the id in your SQL Query. If you do not want the id to show in the tablegrid, you can place "delete_col" for the id in the titles box.
The EDIT button should function normally now.

My apology. I typically do not use the filter in the tablgrid settings. I usually use SQL Query where you can use form fields in the sql. The form field needs to be placed within the braces inside single quotes ( '{edUserId}' ). I don't believe you can place edit fields in the filter box of the tablegrid settings.

You only need the part after the WHERE clause to filter. It looks like in your case that it should be privPage.id_user = {edUserId}

284

(4 replies, posted in General)

Pierre


According to Dimitry, Windows does not allow changing the font color of a checkbox ever since Windows XP. A workaround is to do the following. Erase the caption of the checkbox. Then create a label with the font and color you desire and place it next to the actual checkbox. The nice thing about this is that you can place the label anywhere around the checkbox (front, back, above or below).  The other option is to create an image to simulate the checkbox on and off. You will need to use a little bit of script to switch out the images based on the Boolean value.


Hope this helps.

Also, if you want to prevent the record from saving you can put in

Cancel := True;

I usually will follow it with an Exit; to leave the procedure immediately;

procedure Form2_btnSave_OnClick (Sender: TObject; var Cancel: boolean);
begin
    If Form2.dbAction = 'NewRecord' then ShowMessage('Adding a New Record.');
    If Form2.dbAction = 'ShowRecord' then ShowMessage('Updating a Record.');
end;

287

(35 replies, posted in General)

v_pozidis, thezimguy and any others who may be interested.


I don't mean to muddy the waters, but I wanted to offer my input. You actualy do not need to utilize a n outside
web host for testing. You can use your own computer for your web services, even for your remote users to test.
If you installed XAMPP server, which it sounds like you did, then you are 90% there. You may be 100% there and not even know it.
XAMPP comes with MySql embedded with it so you do not need to install MySql separately. To see if your webserver is working, all you need
is your WAN IP and to make sure your port 80 on your router is open for incoming traffic. These are easy to
accomplish.


To get your WAN IP and to check your port 80, the easiest way to do that is to go to
http://www.portchecktool.com/. You will immediately see your public IP address at the top of the page.
This is your WAN IP. This address is what you use to access your website remotely for testing. Since this is a dynamic IP, which means your ISP can change it once in awhile. This is where you can go to www.noip.com and create a free account for a host name and they
will take care of the changing IP. But for your testing purposes you do not need to do this.


The next step is to look down the page and to the left on the PortCheckTool.com site and you will see your IP address again loaded 
into a box. Underneath this box you will see another box labeled "What Port?". Type in 80 (this is the common
port web servers typically use). Once you type in 80 in that box, then click on the "Check Your Port" button.
A message will appear letting you know if your port is blocked or is open. If it is open, then you are
already set for web access and your remote users can get to your web pages with your database right now.


If your port is blocked, then you need to get into your router's settings and change port 80. I can't help you specifically
on how to access your router's settings because all routers are different, but you should have received instructions that came
with your router on how to do this. Typically it is a specific router address that you type into the address bar
of your browser. You will need your login info which again should have come with your router. Typically it is
username of "admin" and passwrord "admin" or "password". You may be required to change your password if this is the first
time logging into your router. Once you login into your router look for "port forwarding". In port forwarding, look for
port 80. Since every router is different, I don't know exactly what the process is for your router, but there should be
a button or something to enable incoming traffic on port 80. It may say "Enable", "Open", "Allow" or something like that.
As soon as you enable port 80, save your settings and don't forget to record your new password if you changed it.


To test for remote user access. You can use your phone to do this. Bring up the XAMPP control panel on your desktop and turn on
Apache and if you are using MySql also turn on MySql. Make sure you turn off wi-fi on your phone
so your phone is accessing through the internet and not your internal network. Go into your browser on your phone and
type in http://yourpublicid. Your public IP is the WAN IP address displayed on PortCheckTool.com.  Hit ENTER and the XAMPP server dashboard should appear on your phone. If it is displayed then your webserver is working and your website on
your computer can be accessible from the internet. You can have your remote user enter in the same thing on their
computer browser screen and they should see the same XAMPP dashboard page.


All you need to do now is to put your website (php scripts, etc) into the XAMPP htdocs folder. I would recommend creating a separate folder with your web pages. So go into C:\xampp\htdocs and create a new folder. You can name it anything you want (no spaces). Copy your web pages and scripts into this folder. This can be the webgrid scripts generated from MVD. Once you do that go back to your browser and type in http://yourpublicid/yourwebfolder on your phone. Now your website should appear. Your remote user again can type in this same address and see the same thing.


I know I put a lot of words here, but to get your computer accessible as a webhost for testing is really not a long
process and is rather simple. To put icing on the cake, you can actually put a sqlite database in your website. You
won't be able to use MVD webgrid to do this because MVD requires MySql for the webgrid. You will either need to write
your own scripts or use another PHP script generator to be able to access your sqlite database.


I have personally done this and actually use it for my work. I can get to my sqlite desktop database remotely away from my office and any updates are there when I get back to the office in my MVD project on the desktop. But it's only me accessing it. I can turn on/off my web server as needed, if I'm going to be away from the office.  I don't necessarily recommend using sqlite for a lot of users updating online, but a couple is fine. You can have more users if they are just viewing.


Anyone reading this, let me make it clear that if you are going to use your MVD project for heavy duty user interaction to a database in a production environment, then you should use MySql as the database and you probably should use a dedicated computer for webhosting to keep your site open all the time and more secure and especially if you are updating the same database offline and online. Or use a separate webhosting company. Keep in mind that if you use another webhost, then you will need to keep your online database updated from your offline database. Obviously, if you do not have an offline database, then this is not an issue.


Hope this helps and I hope I didn't confuse you. Just to let you know, I'm not an expert in web access. I only know the basics, so for
detailed information I may not be the right person to provide it.

Here is an example

289

(13 replies, posted in General)

lejoso,
Just remove the quotes around the result field (after then) in Derek's calculate field. It makes the field numeric and your report will sum properly.


See below:


case 
when id_types  is     null and id_types1 is     null and id_types2 is     null then 0 
when id_types  is not null and id_types1 is     null and id_types2 is     null then 1 
when id_types  is not null and id_types1 is not null and id_types2 is     null then 2   
when id_types  is not null and id_types1 is null     and id_types2 is not null then 2 
when id_types  is not null and id_types1 is not null and id_types2 is not null then 3 

when id_types1 is     null and id_types  is     null and id_types2 is     null then 0 
when id_types1 is not null and id_types  is     null and id_types2 is     null then 1 
when id_types1 is not null and id_types  is not null and id_types2 is     null then 2   
when id_types1 is not null and id_types  is null     and id_types2 is not null then 2 
when id_types1 is not null and id_types  is not null and id_types2 is not null then 3 

when id_types2 is     null and id_types  is     null and id_types1 is     null then 0 
when id_types2 is not null and id_types  is     null and id_types1 is     null then 1 
when id_types2 is not null and id_types  is not null and id_types1 is     null then 2   
when id_types2 is not null and id_types  is null     and id_types1 is not null then 2 
when id_types2 is not null and id_types  is not null and id_types1 is not null then 3   
end

290

(5 replies, posted in Script)

Dimitry,
That worked to prevent the message. But I'm curious, why didn't I have to do that prior to version 4?   What changed?

Also, a general question, why does the field OnChange event occur before the OnShow event for the form? I would think logically that the OnSHow event would occur first to set the fields on the form and that the OnChange event would only occur when typing into a field. Doing the OnChange event first seems to be wasting a lot of code execution when it is not necessary especially if you have a lot of fields with OnChange events that do not need to be executed at all until changed. Just curious.

291

(5 replies, posted in Script)

Sorry thezimguy, but that is not the process/effect I need. I need the OnChange event to test for the max length of a field before going automatically to the next field. MVD does the field OnChange event before the OnShow of the Form, but for some reason the way I have it in my project worked fine in version 3  but not in Version 4. Thanks for trying though. Appreciate it.

292

(5 replies, posted in Script)

Dimitry,
I'm getting the following error on a field OnChange event when a form is initially opened to show a record in version 4.5.

https://s33.postimg.cc/rjhekdrwv/Cannot_Focus_Error.png


See attached sample. Edit (Double click) the record displayed in the tablegrid. You will get the error. I found this in one of my projects that was compiled under a version 3 (probably 3.6) and it worked fine. When I recompiled it under 4.5 it produces the error.

293

(23 replies, posted in General)

Nice Workaround. Thank you.

294

(3 replies, posted in General)

Awesome! Thank you much Dimitry. And thank you Jean for your efforts as well.

295

(3 replies, posted in General)

Is there a way to retrieve the line number in a memo field when double clicking on a line within the control? I want to ultimately retrieve just the one text line that was double clicked on.

296

(7 replies, posted in General)

tcsplinters,
Just saw that Derek already responded. Sorry. Here is another option. I included a "Plus 365 Days" and a "Plus 12 Months" on the form. They both result in the same answer except on February 28 of a leap year. The 12 months option is accurate in that case, but only by one day.

297

(5 replies, posted in General)

v_pozidis,
I'm not sure if the Translate function will work with that message. You can try it. But I would say probably not. This is not really a user error. You probably have something going wrong in a script accessing a form and should be fixed rather than trying to translate the message.. Can you attach your project and I or someone can take a look.

298

(5 replies, posted in General)

// global event for all exceptions related database
function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
    // exception from button frmStoixeia.Button4
    if Sender = frmStoixeia.Button4 then
    begin
        if Pos('FOREIGN KEY constraint failed', Msg)=1 then
        begin
            result := True; // to prevent system message
            MessageBox('Your Message Here.', 'Error', MB_OK+MB_ICONWARNING);
        end;
    end;
end;

299

(4 replies, posted in Reports)

lejoso,
Attached is a solution. I placed another button on your form to print the report. Did not disturb your button.

300

(2 replies, posted in SQL queries)

i_rortiz,
Welcome to MVD.


Generally speaking each form with a save action will only save one record in one table. MVD does this automatically. You do not need to put in your own SQL inserts. In your scenario, your inventory form will save the inventory record and your inventory details form will save your inventory details record. Having said this, using MVD scripts you can do other SQL updates to other tables if your project requires it. But in a typical master-detail scenario it is not a requirement.


Hope this helps. If you have more questions, do not hesitate to ask. There are plenty of people on this forum who can help.