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,233 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,767 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: 5175 | Replies: 23
Reply
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

  #11  
Nov 9th, 2007
You've made a syntax error somewhere. Please post your code.
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

  #12  
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

  #13  
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

  #14  
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

  #15  
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  
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

  #16  
Nov 12th, 2007
The pascal version is "Bloodshed Dev-Pascal".

bump
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

  #17  
Dec 3rd, 2007
Also, I'm an BIG amateur on this.. I know how to do simple procedures which takes integers or char/string from the main program, make function that tells you sums of an addition or something like that and iterations, selections, types.. not more.. so this is overclass for me, but I want to learn.. also Duoas, I've read that guide before, but still don't understand the "function" in the code.. .
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

  #18  
Dec 3rd, 2007
Most older HLLs make a distinction between a function and a procedure. One returns a value, the other does not.

In C and C++, a procedure is declared by returning void (that is, it doesn't return anything):
void my_proc()
and, of course, a function:
int my_func()

In Pascal, they are:
procedure my_proc;
and
function my_func: integer;

Here's an example:
  1. function intpow( base, exponent: integer ): integer;
  2. // Raises 'base' to the 'exponent' power
  3. // and returns the result.
  4. begin
  5. if exponent < 0
  6. then result := 0
  7. else begin
  8. result := 1;
  9. while exponent > 0 do
  10. begin
  11. result := result *base;
  12. dec( exponent )
  13. end
  14. end
  15. end;
Using this function, I can calculate any non-negative exponent that fits in an integer:
intpow( 2, 0 ) --> 1
intpow( 2, 1 ) --> 2
intpow( 2, 2 ) --> 4
intpow( 2, 3 ) --> 8
etc.

Did this help? Or did I misunderstand you?
Last edited by Duoas : Dec 3rd, 2007 at 3:32 pm.
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

  #19  
Dec 3rd, 2007
I know that one of them returns a value (the function does that, right?) and the other does not..

*back to the topic cause I only want to do a simple popup, buttons or not I don't care.

but if you look at your examples:
should it look like this?

[code=pascal]
program popupwindow;

uses Windows, SysUtils, Dialogs, Messages;

begin
showMessage( 'Hello world!' );

end.

Is that correct? Cause it doesn't work, and I tested the second "show message" you sended.. same thing
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

  #20  
Dec 3rd, 2007
Hmm, I knew about that (but it got complicated at the program part but I know about functions and procedures (functions gives something back and procedures don't)

Back to the thing I wanted done, a popup windows with or without buttons

I've tried the things you wrote before but can't get it to work.. should it look like this:

  1. program popupwindows;
  2. uses Windows, SysUtils, Dialogs, Messages;
  3.  
  4. begin
  5. showMessage( 'Hello world!' );
  6.  
  7. end.

is that it?

Cause it won't work
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 5:04 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC