Forum > LCL

[solved] OnMouseLeave in a TCheckListBox

(1/1)

andyH:
I'm looking at onMouseLeave to see if it solves some some display issues for TCheckListBoxes that I'm using, but I'm doing something stupid.

Method is defined as:

--- 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 TBasePanel.MouseLeave(Sender: TObject);begin  writeln('left a box');end;
In the constructor for TBasePanel I have:

--- 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";}};} ---Box1:= TFoxCheckBox.Create(Self);  with Box1 do begin      other stuff...      OnMouseMove:= @DriveHint;      OnMouseLeave:= @MouseLeave;  end;but I'm getting a compile error on @MouseLeave:

--- Quote ---basepanel.pas(211,23) Error: Incompatible types: got "<procedure variable type of procedure of object;Register>" expected "<procedure variable type of procedure(TObject) of object;Register>"
--- End quote ---

Not obvious to me what I'm doing wrong?

howardpc:
MouseLeave is a protected method of TControl (and so of TBasePanel).
You have a name conflict. {$Mode objfpc} is designed to highlight exactly such ambiguities in your code.
Rename your onmouseleave method to something different from an already declared method name.

andyH:
Thanks, changed the name, compiles. I wish all my problems were that easily solved.

Navigation

[0] Message Index

Go to full version