My first post here so far
And first serious problem in Lazarus, which I cannot solve after two days of non-stop Googling.
Ok, AFAIG all of you know about that specific feature that appears minimizing any Form of application, created under Lazarus. That strange behavior, when form on minimize goes to the left lower corner of desktop (just where START button is placed) and only then minimizes completely to the taskbar. Restoring that application I see that it stretches all over the display width and height and only then takes designed position in the middle of the screen or elsewhere.
Okay, I saw the solution somewhere with some nice patches but I decided to find my own solution without updating sources.
The thing is, that on "Application.Minimize" Form minimizes correctly, just like I wanted. It looks like there's a difference between "Minimizing Application" and "Minimizing currently active Form, even if it's single in project", in other words, difference between "Application.Minimize" and "Form1.WindowState:=wsMinimized." Result from first operation looks normal. When I press button on the systembar of form to minimize it, looks like some kind of similar thing to "Form1.WindowState:=wsMinimized" takes place to happen.
Well, I realized that executing "Application.Minimize" on that button press event (nevertheless, there's no event handler for it) could be that easy solution for me. I decided to trace all messages and on SC_MINIMIZE execute Application.Minimize and leave that message not dispatched. The problem is that I get SC_MINIMIZE only by pressing Minimize option from taskbar popup menu for my application (occasionally, that was the only way to minimize without artifacts by that moment). It looks like pressing "MINIMIZE" button on the form border returns message with
other code, which is not SC_MINIMIZE. That's strange, as far I remember in Delphi those buttons on press event sent SC_MINIMIZE and SC_MAXIMIZE. Here I tried to block event:
procedure TForm1.ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
var tempmessage: tmsg;
begin
getmessage(tempmessage, 0, 0, 0);
if tempmessage.wparam<>61472 then begin
TranslateMessage(tempmessage);
DispatchMessage(tempmessage);
end;
end; 1) How do I get that correct "MINIMIZE" button message code in Lazarus? I could try to check whether left mouse button is unpressed over possible "MINIMIZE" button position, that would be much easier but may cause some possible problems if form border becomes changed by some custom redesign tools that people like to install so often.
Okay, through these two days I was thinking about possible existence of some kind of _MAIN_ form, which is more main, than the one I added
Otherwise, I cannot explain, why minimizing my main application form it acts like it's child of other Form, which goes to taskbar afterwards. And consequently maximizing it stretches all over the screen for a moment and then gets position, just like there's some maximized form on the background. I wish if I could know, HOW and WHY does it work THAT WAY. I couldn't find a way to get handle of that "hidden" form to change it's position, width or something else to make visible form stretch and restore correctly. Searching for Application components returns only Form1, no others. No clues, how to explain that. And, btw, there's no way to get Application handle as I cannot find that property at all (in Delphi was).
2) Could someone explain me, what's the difference between relationships (how do I call it) in application and forms in Lazarus-made applications and others, where minimizing form causes immediate form's border stretching back to taskbar button and restore causes immediate border stretching from taskbar button to form's default position, not elsewhere.
Finally, I would like to apologize if this's an impropriate post in impropriate place. Feel free to laugh/transfer/delete/ban in case of rude violation caused by me. I'm completely new to Lazarus, accidentally found it not so long time ago and I do consider it as a rare luck to see such successful project released under *GPL (last time I said that seeing Blender in action for a first time

).