User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 456,603 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,509 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 5189 | Replies: 23
Reply
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Question How to make a popup window

  #1  
Nov 7th, 2007
Hello DaniWeb. I'm new to this site and will just have to say some words before asking my question. I'm Loyen and I am 14 years old and lives in Sweden. I've just started on an upper secondary school about IT and there I'm going one class that's called "programming" there we're learning the basics in Pascal.

Now, I'm really interested in this, and just wanted to know, how do I do a basic popup window that just gives you a message? Can I make one that has no buttons just a clean window without any "minimazers, closers" and all?

Write it here.

Thank you all for your time and hopefully somebody knows how to do a basic popup window.

//Loyen
Last edited by Loyen : Nov 7th, 2007 at 12:28 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Posts: 15
Reputation: RDWilson2 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
RDWilson2 RDWilson2 is offline Offline
Newbie Poster

Re: How to make a popup window

  #2  
Nov 7th, 2007
Loyen,

Are you using Delphi for this class?

If so, there are several ways to go about doing this, although I would suggest having at least an "OK" button for closing the pop-up window.

One approach, in Delphi, would be to use a MessageDlg.

MessageDlg('Test with no buttons',mtInformation,[],0);

A question for you to consider is, if you create a pop-up window
that has no buttons just a clean window without any "minimazers, closers" and all
, how do you plan to close the window and exit the program?
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to make a popup window

  #3  
Nov 7th, 2007
I didn't plan to close it. ^^
through taskbar if I wanted some time though.

No, we don't use delphi. We are just using Pascal. :/
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to make a popup window

  #4  
Nov 7th, 2007
Which Pascal are you using?
Reply With Quote  
Join Date: Nov 2007
Posts: 15
Reputation: RDWilson2 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
RDWilson2 RDWilson2 is offline Offline
Newbie Poster

Re: How to make a popup window

  #5  
Nov 7th, 2007
Regrettably, it has been far too many years since I worked in base-level Pascal. Sorry.

Also, it really depends on the implimentation of Pascal (i.e. the compiler) with which you are working.
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to make a popup window

  #6  
Nov 7th, 2007
I work with the free Pascal version. (1.9.2)
Reply With Quote  
Join Date: Nov 2007
Posts: 44
Reputation: Loyen is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Loyen Loyen is offline Offline
Light Poster

Re: How to make a popup window

  #7  
Nov 9th, 2007
program WindowsApp;
Uses
Messages, Windows

Begin

<code>
function MessageDlg( const msg: string; dlgType: tMsgDlgType; buttons: tMsgDlgButtons; helpctx: longint ): word;
</code>
approach and you do NOT want any buttons (which is still a most curious concept), you would write something like:
<code>
MessageDlg('your message goes here', mtInformation,[],0);
</code>
END.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to make a popup window

  #8  
Nov 9th, 2007
You need to read up on how to use procedures and functions.
Here's a nice tutorial.

Also, to use the MessageDlg function, you will need to put the Dialogs unit in your uses clause.

Good luck.
Last edited by Duoas : Nov 9th, 2007 at 4:19 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 87
Reputation: squidd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
squidd squidd is offline Offline
Junior Poster in Training

Re: How to make a popup window

  #9  
Nov 9th, 2007
Im not sure about FP but I know if they are compatible as Duaos mentioned... Then simply do something like:


Procedure TForm.FormCreate(Sender: TObject);
begin
label.caption := 'write what you want to here';
end;

Again, I dont know if that will work in FP. But if you can get that to work, then great! Then goto (if you have this) object inspector and remove anything you dont want there. click on the form itself first of course and then look for the minimize and close options in there.

I am probably way off base on what you need, but I am trying anyway. lol
Last edited by squidd : Nov 9th, 2007 at 6:32 pm.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to make a popup window

  #10  
Nov 9th, 2007
That would work.

You would have to create a new form, and show it to display the message, and hide it to stop displaying the message. The trick is to let the user dismiss the form, which means responding to button presses or the [X] button or "Close" option of the window menu or if the user presses ENTER or ALT+F4. To do that stuff you'd have to display the form with showmodal, which I don't think you know enough to do easily.

If you are using Free Pascal and not the GNU Pascal (the Bloodshed Dev IDE works with both), then make sure you have the Dialogs unit in your uses clause:
uses Windows, SysUtils, Dialogs, Messages;

and to display a message use:
showMessage( 'Hello world!' );
This displays a popup with the message and an OK button.

Or use:
messageDlg( 'Hello world!', mtCustom, [], 0 );
to display the dialog without buttons. (I have never tried to show one without buttons. It may or may not work. Either way, you will still be able to click the [X] button or press ESC to terminate the dialog.)

Hope this helps. (And please read-up like I asked.)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Pascal and Delphi Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 7:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC