1 (edited by borisavljevic 2021-02-23 22:41:14)

Topic: DBFile1.LeftButton.Click

Hi,

Is there a way to make this work:

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  Form1.DBFile1.LeftButton.Click;
end;

I know this code doesn't work but is there a way to make on button click to make event DBFile left button click. I want to hide DBFile left and right buttons and make separate button for adding files.

Thanks in advance,
Vladimir

Re: DBFile1.LeftButton.Click

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  Form1.LeftButton.Click;
  Form1.RightButton.Click;

  // It's the same for all buttons
  // When you click button 1 all those buttons will click too.  
  // Derek can give you a downloadable example.  Greetings
end;

3 (edited by borisavljevic 2021-02-24 18:55:17)

Re: DBFile1.LeftButton.Click

Hi wenchester21,

That's not what I wanted. Take look at picture, there is left and right buttons on the DBFile1.

Post's attachments

Attachment icon left and right buttons.jpg 8.91 kb, 126 downloads since 2021-02-24 

Re: DBFile1.LeftButton.Click

Anyone with solution?

Re: DBFile1.LeftButton.Click

Hi Vladimir,
You can hide the left and right buttons easily enough with
form1.leftbutton.visible := false;
form1.rightbutton.visible := false;
But I'm not sure what you would use to replicate the 'leftbutton'.click;  I tried a few things but it always opens the selected file rather than saving it either as a 'storefile' or a 'linkfile'
Derek.

Re: DBFile1.LeftButton.Click

Hi Derek,

I tried few thing too, without success.

Thanks for your time anyway.

All the best,
Vladimir

Re: DBFile1.LeftButton.Click

I am not sure I fully understand what you want but attached is an alternative to the DbFile component.

Post's attachments

Attachment icon File Alt.zip 337.43 kb, 289 downloads since 2021-02-26 

8 (edited by borisavljevic 2021-02-27 09:11:53)

Re: DBFile1.LeftButton.Click

Hi ehwagner,

That's not exactly what I wanted but it's good enough workaround and it works well. One more question. Is there a way to auto rename file when saving file using component DBFile with property CopyTo? What I'm trying is something like this:

procedure Form2_Button_Save_OnClick (Sender: TObject; var Cancel: boolean);
begin
  Form2.DBFile1.dbFileName := 'Test '+ (FormatDateTime('dd.MM.yyy.',(now)));
end;

but this doesn't work.

Thank you for help and for your time.
Vladimir