•
•
•
•
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
![]() |
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
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.
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.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
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.
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.
•
•
Join Date: Nov 2007
Posts: 87
Reputation:
Rep Power: 2
Solved Threads: 1
Im not sure about FP but I know if they are compatible as Duaos mentioned... Then simply do something like:
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
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.
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
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:
and to display a message use:
This displays a popup with the message and an OK button.
Or use:
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.)
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.)
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
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.. .
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
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):
and, of course, a function:
In Pascal, they are:
and
Here's an example:
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?
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:
Pascal Syntax (Toggle Plain Text)
function intpow( base, exponent: integer ): integer; // Raises 'base' to the 'exponent' power // and returns the result. begin if exponent < 0 then result := 0 else begin result := 1; while exponent > 0 do begin result := result *base; dec( exponent ) end end end;
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.
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
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
*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
•
•
Join Date: Nov 2007
Posts: 44
Reputation:
Rep Power: 2
Solved Threads: 0
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:
is that it?
Cause it won't work
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:
Pascal Syntax (Toggle Plain Text)
program popupwindows; uses Windows, SysUtils, Dialogs, Messages; begin showMessage( 'Hello world!' ); end.
is that it?
Cause it won't work
![]() |
•
•
•
•
•
•
•
•
DaniWeb Pascal and Delphi Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Popup window on button click (ASP.NET)
- Help with popup window (Visual Basic 4 / 5 / 6)
- how to pass the value in popup window (PHP)
- Please help me with my javascript popup window! (ASP.NET)
- Javascript Popup Window (JavaScript / DHTML / AJAX)
- Popup window (ASP.NET)
- Make An Asp Popup Window--help Me About This... (JavaScript / DHTML / AJAX)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: help file creation
- Next Thread: How would I find a system's IP address in Delphi?



Linear Mode