Topic: iconize via script

Hi, MVD Guru, how can I iconize the form via script? How can make it draggable by mouse via script? Is possible?
Thanks Riccardo.

Re: iconize via script

Hello,


Can you let me more info, what is it "iconize" ?

Dmitry.

Re: iconize via script

I would use a form without borders without default buttons for closing ... from here all right; Now I would like my form is draggable, and that via a button I can reduce it to an icon in the windows bar.
thanks Riccardo

Re: iconize via script

Hello madbit71

In fact, you want hide and restore your application to and from taskbar, isn'it ?

If MVD accepts Application.MainFormOnTaskbar event (I ask question to Dmitry), you can put it to True

So to minimize your application :

Use : MyApplication.MyForm.Visible := False.

MyApplication.Minimize;
MyApplication.MyForm.Visible := False;


and to restore it

MyApplication.MyForm.Visible := True;
MyApplication.Restore;

It can be a clue for your question

JB

Re: iconize via script

madbit71 wrote:

I would use a form without borders without default buttons for closing ... from here all right; Now I would like my form is draggable, and that via a button I can reduce it to an icon in the windows bar.
thanks Riccardo

you can do it using script, except reduce it to an icon in the windows bar.

script

var
    isMouseDown: boolean;
    offx, offy: integer;

procedure Form1_OnMouseMove (Sender: string; Shift, Alt, Ctrl: boolean; X, Y: Integer);
begin
    if isMouseDown then
    begin
        Form1.Left := Form1.Left - offx + X;
        Form1.Top := Form1.Top   - offy + Y;
    end;
end;
                   
procedure Form1_OnMouseDown (Sender: string; MouseLeft, MouseRight, MouseMiddle: boolean; Shift, Alt, Ctrl: boolean; X, Y: Integer);
begin
    if MouseLeft then
    begin
        isMouseDown := True;
        offx := x;
        offy := y;
    end;
end;

procedure Form1_OnMouseUp (Sender: string; MouseLeft, MouseRight, MouseMiddle: boolean; Shift, Alt, Ctrl: boolean; X, Y: Integer);
begin
    if MouseLeft then isMouseDown := False;
end;

begin
    Form1.BorderStyle := bsNone;
    Form1.mniFile.Visible := False;
    Form1.mniOptions.Visible := False;
    Form1.mniAbout.Visible := False;
end.


also you can download project:

Post's attachments

Attachment icon Form without borders draggable.zip 3.4 kb, 491 downloads since 2015-11-24 

Dmitry.

Re: iconize via script

Great...it's perfect...my form is draggable...thank you.
Riccardo.