Topic: two questions - Help

hello,

i want to implement two functions in my project but dont know how to start or do it.

1) i have a form that i filled with information of a product, but i want to put a button in that form that when i click on it, it will open a new form with the information that i filled in the first one, but the difference is that the second form that opens will be read only.

2) i have two date time picker in two different forms, but basically they are the same so, how can i change only one in one form and automatically change the other that is on the other form?

thanks very much for any help

2 (edited by rjkantor 2015-03-02 16:08:00)

Re: two questions - Help

#1 ) It depends how you want the read only screen to appear.

You can have the second form to display all the information as labels or you can make the edit fields readonly via the property setting.


You can add a button to the form and then create an onclick event and display information as Labels

procedure Form1_Button3_OnClick (Sender: string; var Cancel: boolean);

begin

   Form2.Label1.Caption := 'Field 1: ' + Form1.Edit1.Text ;
   Form2.Label2.Caption := 'Field 2: ' + Form1.Edit2.Text;
....
....
    Form2.showmodal;
end;

#2)

You can create an onchange event on Form1 for the DatePicker and it will set the second DatePicker.

procedure Form1_DateTimePicker1_OnChange (Sender: string);
begin
   Form2.DateTimePicker2.Date := Form1.DateTimePicker1.Date;
end;

I hope this helps.

Rob

3 (edited by Montenegr0 2015-03-02 16:59:36)

Re: two questions - Help

it helps a lot smile thanks wink

in your first answer is there other way  instead of being in label format? can be possible show the Form1 text in a Form2 TextBox? and make it read only for example.

because if it is in label format i can´t send it to a report.

Re: two questions - Help

already did it smile

thanks once again

Re: two questions - Help

Montenegr0 wrote:

already did it smile

thanks once again

Good to hear that you figured it out.

Rob