Forum > General

[RESOLVED] OnClick causes crash

(1/3) > >>

Riccardo Giuliani:
Hi everybody!

Little question: I dinamically create a new form with a progbar inside it, whom progression i manage into another procedure, referring to progbar with
--- Code: ---tprogbar(findcomponent('nameofprogbar'));
--- End code ---
In the previous procedure, i set OnClick := @myprocedure; as in the example

--- Code: ---with newform do
  ....
  with progbar do
    ...
    OnClick := @myprocedure;

--- End code ---

Now... myprocedure(sender: tobject) is required to perform some actions among which there's newform.close.
Every time i click on progbar appears "project raised exception class 'external: sigsegv'" and source editor opens the control.inc file directly to row 1072

--- Code: ---MouseUp(Button, KeysToShiftState(Keys), XPos, YPos);
--- End code ---
in DoMouseUp procedure.

Obviously, calling myprocedure without click event will get the goal.

So... am i doing anything wrong or could it be a bug?

Thanks.

typo:
Is the component a TProgressBar?

Riccardo Giuliani:

--- Quote ---
--- End quote ---
Yes; and to be sure i put

--- Code: ---if Sender is TProgressBar then ShowMessage('prog');
--- End code ---
into myprocedure.

typo:
This occurs even if you run the program outside the IDE?

Riccardo Giuliani:
I Get an Access Violation

Navigation

[0] Message Index

[#] Next page

Go to full version