Recent

Author Topic: TShape.SetTempCursor, how does this work?  (Read 534 times)

jamie

  • Hero Member
  • *****
  • Posts: 6964
TShape.SetTempCursor, how does this work?
« on: May 11, 2025, 03:52:02 pm »
Consider this.

Code: Pascal  [Select][+][-]
  1.  
  2. procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,
  3.   Y: Integer);
  4. begin
  5.   Shape1.SetTempCursor(crHandPoint);
  6. end;                      
  7.  

When I do this, the cursor does not change!

A little input would be helpful.

Jamie
The only true wisdom is knowing you know nothing

Fibonacci

  • Hero Member
  • *****
  • Posts: 757
  • Internal Error Hunter
Re: TShape.SetTempCursor, how does this work?
« Reply #1 on: May 11, 2025, 03:59:48 pm »
Code: Pascal  [Select][+][-]
  1. class procedure TWSWinControl.SetCursor(const AWinControl: TWinControl; const ACursor: HCursor);
  2. begin
  3. end;

Its empty :o

jamie

  • Hero Member
  • *****
  • Posts: 6964
Re: TShape.SetTempCursor, how does this work?
« Reply #2 on: May 11, 2025, 04:07:28 pm »
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.
The only true wisdom is knowing you know nothing

zeljko

  • Hero Member
  • *****
  • Posts: 1765
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TShape.SetTempCursor, how does this work?
« Reply #3 on: May 11, 2025, 08:34:25 pm »
Code: Pascal  [Select][+][-]
  1. class procedure TWSWinControl.SetCursor(const AWinControl: TWinControl; const ACursor: HCursor);
  2. begin
  3. end;

Its empty :o

Yes, it is overrided/implemented in widgetsets.

jamie

  • Hero Member
  • *****
  • Posts: 6964
Re: TShape.SetTempCursor, how does this work?
« Reply #4 on: May 20, 2025, 12:18:03 am »
The point was this :

 
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,
  2.   Y: Integer);
  3. begin
  4.    {Make sure Shape is something other than a Square}
  5.   With TShape(Sender) do
  6.    Begin
  7.      If PtInShape(Point(X,Y)) then
  8.         Cursor := crHandPoint else {SetTempCursor does nothing so must change main cursor}
  9.         Cursor := Parent.Cursor; {Would be nice if I didn't need to do this way}
  10.    end;
  11.  
  12. end;                        
  13.  

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 ?
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018