Hi
In my application, there is a form called setupForm, called from the main form by a button.
On the setupForm, there is another button called Reset. The ResetBtnClick function is as follows:
procedure TSetupForm.ResetBtnClick(Sender: TObject);
begin
if MessageDlg('Warning', 'This will clear ALL current settings',
mtConfirmation, [mbOk, mbCancel], 0) = mrCancel then exit;
ShowMessage('Got here'); //temp for fault finding!
PerDay.Value := 0;
PerDay.Enabled := true;
Cost.Value := 0;
EPD.Checked[0] := true;
Cunit.ItemIndex := 1;
Tap.Checked[0] := false;
Imax.Value := 16;
StartDate.Date := Now;
SetupForm.Repaint;
//command sent to PIC micro via ttyUSB1
PortCom1.WriteData('*reset' + #13#10);
end;
On clicking the Reset button, in my ignorance, I would expect to see the MessageDlg appear, but it doesn't. The screen briefly flashes and that's all!
If you then click the Reset button a second time, the MessageDlg appears. However, choosing OK does not bring up the 'Got Here' message!
Clicking the Reset button for a third time shows the 'Got Here' message only!
Why is this happening and how can I make it work as logic dictates it should?
fpc 3.1.1, lazarus 1.5, Raspberry Pi with Raspbian
Thanks
Brian