Search the Community
Showing results for tags 'showmessage button click'.
Found 1 result
Show Message on Button Click
Rooster posted a topic in Script HelpHi everyone, I'm slowly getting the hang of scripting so Please keep your as simplified as possible. After making some besic scripts I want to combine them under 1 single program... So I'm trying to make a form with basic buttons to assign my scripts to, but I can't even make a button click to show a message. I succeeded in getting a message box with a basic script using the ShowMessage function, but as soon as i try it in a form, it won't work. Here's the code: type TForm1 = record Form1: TForm; Button1: TButton; end; var Form1: TForm1; procedure TestButton; begin ShowMessage('ok') end; procedure Button1Click(sender: TObject); begin case sender of Form1.Button1: TestButton; end; end; procedure Form1_Init; begin with Form1 do begin Form1 := CreateForm; Button1 := TButton.Create(Form1); with Form1 do begin Left := 228; Top := 129; 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 := 4; Top := 4; Width := 296; Height := 40; Caption := 'Button1'; 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; begin Form1_SafeInit; Form1_SafeShowModal; FreeForm(Form1.Form1); end.; So if anyone sees what I'm doing and wants to tell me, Thanks in advance