Forum > Beginners

How to change form callback dynamically?

(1/1)

trayres:
Is there a way such that I can change a form's event callback at runtime?

I'd like to change the OnMouseDown event depending on the state of what's going on. That information is in the *.lfm file.

I think I'd just access the main form, and use the @notation for the address of a procedure. Am I on the right track here?

Stupid question, sorry.

Ñuño_Martínez:
Just assign it:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  PROCEDURE TForm1.Whatever;  BEGIN  { For example. }    IF SELF.UseProc_A THEN      SELF.OnMouseDown := @SELF.HandleOnMouseDown_A    ELSE      SELF.OnMouseDown := @SELF.HandleOnMouseDown_B  END; 
--- Quote from: trayres on May 20, 2016, 06:02:28 pm ---Stupid question, sorry.

--- End quote ---

It would be worst if you don't ask. ;D

trayres:
Hi  Ñuño,

Thanks for the help, this will simplify my code dramatically :)

Navigation

[0] Message Index

Go to full version