ShowModal - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ShowModal

MrKMrK Posts: 19Member
I have This Code to Display a Form:

if not assigned(MyForm) then
MyForm := TMyForm.Create(Application);
MyForm.ShowModal;

When the program compiles, it says that it 'Cannot make a visible window modal.' I don't even have to use the ShowModal part for the form to show but I don't want the user to do anything until this form is closed.

Also, I have a Statusbar on a form and I want to display a different text when the mouse moves over different somponents. I know I have to use on OnMouseMove event handler but I don't know how to set/change the text on the statusbar.

Please help.

Thanks.

Mrk

Comments

  • zibadianzibadian Posts: 6,349Member
    : I have This Code to Display a Form:
    :
    : if not assigned(MyForm) then
    : MyForm := TMyForm.Create(Application);
    : MyForm.ShowModal;
    :
    : When the program compiles, it says that it 'Cannot make a visible window modal.' I don't even have to use the ShowModal part for the form to show but I don't want the user to do anything until this form is closed.
    :
    : Also, I have a Statusbar on a form and I want to display a different text when the mouse moves over different somponents. I know I have to use on OnMouseMove event handler but I don't know how to set/change the text on the statusbar.
    :
    : Please help.
    :
    : Thanks.
    :
    : Mrk
    :
    The first problem is very weird, since the code looks quite similar to what I've been doing successfully for years. Perhaps the mainform is also called MyForm. This would mean that the form is already visible. Try to change the name of the form variable.
    The second problem is quite simple to solve, but you're on the wrong track. You need to use the TApplication.OnHint event. The higher versions of Delphi (sure about version 5) has a component called ApplicationEvents on the Additional page. You can use that to use the Object Inspector to get to the event. Otherwise you need to type the code yourself. Also make sure that the ShowHint property of the controls is set to true.
  • PerranPerran Posts: 241Member
    : I have This Code to Display a Form:
    :
    : if not assigned(MyForm) then
    : MyForm := TMyForm.Create(Application);
    : MyForm.ShowModal;
    :
    : When the program compiles, it says that it 'Cannot make a visible window modal.' I don't even have to use the ShowModal part for the form to show but I don't want the user to do anything until this form is closed.
    :
    : Also, I have a Statusbar on a form and I want to display a different text when the mouse moves over different somponents. I know I have to use on OnMouseMove event handler but I don't know how to set/change the text on the statusbar.
    :
    : Please help.
    :
    : Thanks.
    :
    : Mrk
    :
    Are you sure it isn't autocreating? Check your project options. If not, it's kinda odd. I suppose you could always make its visible property false and then show it modally. The status bar thing is easy. Simply set the Autohint property to true and set one of the panels [usually 0 to be the help panel.] In v4.0 and earlier, you'll need to do it as Zibadian outlines.
Sign In or Register to comment.