Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.