fiblearn Posted November 30, 2013 Share Posted November 30, 2013 Hello, i need some help for Button1 (event-button-onclick-execute a specificate procedure) type TForm1 = record Form1: TForm; Button1: TButton; end; var Form1: TForm1; procedure TestButon; begin WriteLn('Butonul functioneaza'); end; procedure Form1_Init; begin with Form1 do begin Form1 := CreateForm; Button1 := TButton.Create(Form1); with Form1 do begin Left := 333; Top := 302; Caption := 'Form1'; ClientHeight := 202; ClientWidth := 304; Color := clWindow; Font.Charset := DEFAULT_CHARSET; Font.Color := clWindowText; Font.Height := -11; Font.Name := 'Tahoma'; Font.Style := []; OldCreateOrder := False; PixelsPerInch := 96; end; with Button1 do begin Parent := Form1; Left := 0; Top := 182; Width := 304; Height := 20; Align := alBottom; Caption := 'Run!'; TabOrder := 0; end; end; end; procedure Form1_SafeInit; var v: TVariantArray; begin SetLength(v, 0); ThreadSafeCall('Form1_Init', v); end; function Form1_ShowModal: Boolean; begin Result := Form1.Form1.ShowModal = mrOk; end; function Form1_SafeShowModal: Boolean; var v: TVariantArray; begin SetLength(v, 0); Result := ThreadSafeCall('Form1_ShowModal', v); end; I do not want to bother anyone with my questions, I searched for doc. some time and still have not found. I apologize if the post is stupid Quote Link to comment Share on other sites More sharing options...
Janilabo Posted November 30, 2013 Share Posted November 30, 2013 Do you need... type TForm1 = record Form1: TForm; Button1: TButton; end; var Form1: TForm1; procedure TestButon; begin WriteLn('Butonul functioneaza'); end; procedure ButtonClick(sender: TObject); begin case sender of Form1.Button1: TestButon; end; end; procedure Form1_Init; begin with Form1 do begin Form1 := CreateForm; Button1 := TButton.Create(Form1); with Form1 do begin Left := 333; Top := 302; Caption := 'Form1'; ClientHeight := 202; ClientWidth := 304; Color := clWindow; Font.Charset := DEFAULT_CHARSET; Font.Color := clWindowText; Font.Height := -11; Font.Name := 'Tahoma'; Font.Style := []; OldCreateOrder := False; PixelsPerInch := 96; end; with Button1 do begin Parent := Form1; Left := 0; Top := 182; Width := 304; Height := 20; Align := alBottom; Caption := 'Run!'; TabOrder := 0; OnClick := @ButtonClick; end; end; end; procedure Form1_SafeInit; var v: TVariantArray; begin SetLength(v, 0); ThreadSafeCall('Form1_Init', v); end; function Form1_ShowModal: Boolean; begin Result := Form1.Form1.ShowModal = mrOk; end; function Form1_SafeShowModal: Boolean; var v: TVariantArray; begin SetLength(v, 0); Result := ThreadSafeCall('Form1_ShowModal', v); end; begin Form1_SafeInit; Form1_SafeShowModal; FreeForm(Form1.Form1); end. Something like that? Quote Link to comment Share on other sites More sharing options...
fiblearn Posted December 1, 2013 Author Share Posted December 1, 2013 Thanks a lot, great community! Quote Link to comment Share on other sites More sharing options...
Wanted Posted December 3, 2013 Share Posted December 3, 2013 Glad we could help Quote Link to comment Share on other sites More sharing options...