26

(16 replies, posted in Script)

Dmitry,

I had tried that, this is why it  was so confusing.  You have to have it on both OnFormShow event and on the OnChange event or it will not work.  It must be in both places.


Just OnShow will not allow selection of the DBFile box at all.


Just OnChange will allow you select it no matter what.


Using both together gets me the result that I need.

So it must be like this to work

procedure add_file_ComboBox2_OnChange (Sender: TObject);

begin
    if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := False else add_file.DBFile1.Enabled := True;
end;

procedure add_file_OnShow (Sender: TObject; Action: string);
begin
    if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := False else add_file.DBFile1.Enabled := True;
end;

Thanks

Thanks to you too ehwagner.  The research really helps, sometimes I find stuff by accident that way.

27

(16 replies, posted in Script)

ehwagner wrote:

You need to place your IF statement inside the OnChange event of the combobox. See attached revision.

Thank you so much, I tried so many things and researched for hours before asking.  I thought that I had tried that too.  I am learning a lot from you guys.  Again thanks from Texas!!!!!

28

(16 replies, posted in Script)

DriveSoft wrote:

just change this line

if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := True else add_file.DBFile1.Enabled := False;

to

if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := False else add_file.DBFile1.Enabled := True;

Dmitry,

Thank you

I did change it.  Now it stays disabled even after selection.
I attached a zip with it changed.

29

(16 replies, posted in Script)

DriveSoft wrote:

I checked, it works for me. Please attach your project (zip file without exe and dll), I'll test it.

Here you go Sir

30

(16 replies, posted in Script)

Dmitry,


if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := False else add_file.DBFile1.Enabled := True;

Enabled and Disabled is not working with DBFiles using combobox.dbItemID = -1

i have even set the combobox to -1 on show

procedure add_file_OnShow (Sender: TObject; Action: string);
begin
add_file.ComboBox2.dbItemID := -1;
if add_file.ComboBox2.dbItemID = -1 then add_file.DBFile1.Enabled := False else add_file.DBFile1.Enabled := True;
end;

Im not sure why

I am on 6.3 i haven't tried to go back to an earlier version.

Hello Dmitry,

Thanks for the quick response, however it still isn't working for me.  I have not made any changes to the example.  I just added a picture to John over and over again and it is still the same. I have attached a screenshot.

Thanks,
Sonny

Hello,

I downloaded the example, and I cannot get it to work.  Even with no changes to the phonebook example.  It just keeps adding 1 to the photo names.  Like
image.jpg,  image(1).jpg, image(2).jpg and so on. 
It doesn't rename them from the original name, or give a warning that the file exists.  I would just like to delete the existing file from the folder (or overwrite) when I select a new one.  Any help would be appreciated.  I love MVD!!!!!!

Thanks,
Sonny
MVD 6.2

Correction MVD 6.3!!!!!!