Forum > Linux

SendMessage with Linux

(1/1)

IniWo:
Hello,

with lazarus-2.0.12-fpc-3.2.0-win64, I can move a Form by clicking on its background [and on its TControl]

--- 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";}};} ---if Msg = LM_MOUSEMOVE then    begin      ReleaseCapture();      SendMessage(Self.Handle, LM_NCLButtonDown, HTCaption, 0);    end;The same code in Linux has no effect [even if no compilation error appears].
Is SenMessage inoperative on Linux or am I doing it wrong ?

Best regards. IW

MarkMLl:
The documentation suggests to me that it's not intended to work on any OS other than Windows: are you absolutely certain that those message numbers are portable?

MarkMLl

IniWo:
Hello,
i suspected it doesn't work with linux or mac os.  But I had not found the documentation specifying it..
So I'll use the classic onMouseDown and co in a less elegant way.
Best regards. IW

howardpc:
I think on Linux the LM_NCLMouseButtonDown message is not interpreted  by window managers in the same way as on Windows.
For cross-platform use you have to do some variation on this sort of thing:

--- 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.ApplicationProperties1UserInput(Sender: TObject; Msg: cardinal);var  pt: TPoint;begin  case Msg of    LM_LBUTTONDOWN: begin                      if not bPotentiallyMoving then                        bPotentiallyMoving := True;                      Cursor := crDrag;                    end;    LM_LBUTTONUP: begin                    bPotentiallyMoving := False;                    Cursor := crDefault;                  end;    LM_MOUSEMOVE: if bPotentiallyMoving then                    begin                      pt := ScreenToClient(Mouse.CursorPos);                      Left := ClientOrigin.X + pt.X;                      Top := ClientOrigin.Y + pt.Y;                    end;  end;end;

MarkMLl:

--- Quote from: IniWo on July 21, 2021, 06:36:42 pm ---Hello,
i suspected it doesn't work with linux or mac os.  But I had not found the documentation specifying it..
So I'll use the classic onMouseDown and co in a less elegant way.
Best regards. IW

--- End quote ---

Out of curiosity: you've said it doesn't work but is that code successfully executed (i.e. if you put a debugger on that SendMessage())?

The documentation is phrased as though it's intended to be used if you're recompiling something which works on Delphi on the same platform. I am by no means an LCL expert, and responded primarily to make sure your question remained visible in the "Recent" list... grepping the sources it looks as though LM_NCLBUTTONDOWN is defined but literally never used.

OTOH LM_MOUSEMOVE appears in the code for all the widget sets.

MarkMLl

Navigation

[0] Message Index

Go to full version