[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Disabling guitting the program ???



>-----Original Message-----
>From: Serguei DACHIAN <Serguei.Dachian@univ-lemans.fr>
>To: vgui-discuss@other.debian.org <vgui-discuss@other.debian.org>
>Date: Sunday, December 06, 1998 10:17 PM
>Subject: Disabling guitting the program ???


>Hi everybody.
>
>I'm using V at Win98 box with CygWinB20 compiler. I am writig some program
>which must not be closed during certain computations (I must not to allow
>interrupting the computations). The computations are heavy and long, so
>while computing I do periodically "CheckEvents", in order to allow the
>window to be moved/resized/etc during the computation, but I have do
disable
>closing!!! It is easily acheeved for "Exit" entry in "File" menu and for
>"Exit" button that I have in my ToolBar/CommandPane, by setting their
>Sensetive to 0. But one can still close the application by doubleclicking
>the upperleft corner, or simpleclicking the upperright corner of the window
>(don't forget I am under Win98). So the question is: can I disable this
>buttons too, or not???  Or mayby this is a question about CygWinB20
>compiler, rather than about V???


I guess it's about some virtual functions of vApp and vWindow
You can override vWindow::CloseWin() in a way:

// I guess it will be done in command window
void my_cmd_win::CloseWin()
{
    if (disable)
    {
        note("cannot close window ...");
        return;
    }
    vCmdWindow::CloseWin();
}

That will lock the wimdow.
And the application call Exit() method to initiate normal program
termination,
which can be override in a similar way. This method is usually called (in
command window by WindowCommand()) when File/Exit is selected and with
other "legal" exit methodds, like Alt+F4 or "x" in right upper corner.

Best regards, Nikolay




Reply to: