Forum > LCL

TShape.SetTempCursor, how does this work?

(1/1)

jamie:
Consider this.


--- 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.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,  Y: Integer);begin  Shape1.SetTempCursor(crHandPoint);end;                        
When I do this, the cursor does not change!

A little input would be helpful.

Jamie

Fibonacci:

--- 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";}};} ---class procedure TWSWinControl.SetCursor(const AWinControl: TWinControl; const ACursor: HCursor);beginend;
Its empty :o

jamie:
No, it does go to code, use a break point and you will see it steps to it.

In any case, I think maybe what is happening is the MouseMove event is setting the cursor back to what the cursor property is set for on exit of the event.

 Maybe it should be doing this upon entry of the event so that a cursor change can be made and held.

zeljko:

--- Quote from: Fibonacci on May 11, 2025, 03:59:48 pm ---
--- 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";}};} ---class procedure TWSWinControl.SetCursor(const AWinControl: TWinControl; const ACursor: HCursor);beginend;
Its empty :o

--- End quote ---

Yes, it is overrided/implemented in widgetsets.

jamie:
The point was this :

 
--- 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.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,  Y: Integer);begin   {Make sure Shape is something other than a Square}  With TShape(Sender) do   Begin     If PtInShape(Point(X,Y)) then        Cursor := crHandPoint else {SetTempCursor does nothing so must change main cursor}        Cursor := Parent.Cursor; {Would be nice if I didn't need to do this way}   end; end;                          
as you can see, you can't set the Cursor from the LFM because it needs to be changed at runtime.

Maybe we need a InShapeCursor property ?

Navigation

[0] Message Index

Go to full version