[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Many Simple Questions

Posted on 2004-10-31
13
Medium Priority
?
162 Views
Last Modified: 2010-04-05
what is exit For in delphi
(how to skip the for loop)
what is exit sub in delphi
(skip all the sub)
how to totally exit all the application?(not just one form)
how to Unload a form not just hide it?

how to know all the procedures of a specific component.
Like Forum, if you click (dblclick) you will get
procedure TForm1.FormCreate(Sender: TObject);

but how to get
procedure TForm1.FormDestroy(Sender: TObject);
and other things?

and what is Text1_KeyPress? and what is the ENTER BUTTOM
ie. how to lanch a procedure when someone clicks enter in a edit box?

whats the difference between Complie Project1, and Build Project1.

And what are these in Delphi:
App.Path = STRING
App.TaskVisible = Boolean
app.Title = STRING

In VB I used to creat a model and put the public subs and functions I creat there, where should I put the public subs and functions?
0
Comment
Question by:deathman5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
13 Comments
 
LVL 7

Assisted Solution

by:sftweng
sftweng earned 160 total points
ID: 12458048
--------------------------
 what is exit For in delphi
(how to skip the for loop)
Break (Continue skips within the for loop to the next iteration)
--------------------------
what is exit sub in delphi
(skip all the sub)
Exit
---------------------------
how to totally exit all the application?(not just one form)
In addition to displaying the exception message, which happens by default, the following code shuts down the application when an exception is not caught and handled.

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnException := AppException;

end;

procedure TForm1.AppException(Sender: TObject; E: Exception);

begin
  Application.ShowException(E);
  Application.Terminate;
end;
----------------------------------
how to Unload a form not just hide it?
Closes the form.

procedure Close;

Description

Call Close to close a form.

Attempts to close a form can be aborted by the CloseQuery event dispatcher or the OnCloseQuery event handler.

Note:      When the main form of the application closes, the application terminates.
---------------------------------------
how to know all the procedures of a specific component.
Like Forum, if you click (dblclick) you will get
procedure TForm1.FormCreate(Sender: TObject);

but how to get
procedure TForm1.FormDestroy(Sender: TObject);
and other things?

The Object Inspector Events tab allows you to double-click to create event handlers for the form.

Otherwise, look at Delphi Help for TForm for the Properties, Methods and Events
----------------------------------------
and what is Text1_KeyPress? and what is the ENTER BUTTOM
ie. how to lanch a procedure when someone clicks enter in a edit box?
Again, look at the Object Inspector Events and help for TEdit
--------------------------------------------
whats the difference between Complie Project1, and Build Project1.
Compile does only the changed units while build does all.
-------------------------------------------
And what are these in Delphi:
App.Path = STRING
App.TaskVisible = Boolean
app.Title = STRING
See help for "Application" and "TApplication"
--------------------------------------------

In VB I used to creat a model and put the public subs and functions I creat there, where should I put the public subs and functions?

Each class has "Private", "Protected", "Public" and "Published" sections.

non-class-related procedures and functions can just be declared inline in the code for a unit.
0
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 280 total points
ID: 12458358
1) Calling Exit; you will quit the CURRENT routine.
    If you want to skip a loop - user break;
    Application.Terminate; terminates to application
    Form1.Free; or FreeAndNil(Form1) will unload the form.

2) Click on the component - form, button or ... whatever you have. Press F11 and you will see the Object inspector. There you have properties and Events. Events are what you need.

3)
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    begin
      // ENTER was pressed
      // .....
    end;
end;

4) Application.ExeName
    App.TaskVisible = Boolean  <- I am not sure about this, but is seems Application.ShowMainForm to me
    Application.Title

5)
  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    procedure PrivateProcedure;   // PRIVATE
  public
    procedure PublicProcedure;    // PUBLIC
  end;
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 160 total points
ID: 12463311
Okay, I'm going to be nasty. Sorry... I'm a perfectionist with Delphi and some things annoyed me.
------------------------------------
what is exit For in delphi
(how to skip the for loop)

That would be the Break command but if you would be using this and you'd be working for me, I'd tell you to go find another job. Sorry, but in Pascal the use of Break is quite easy to avoid and just makes the code more unreadable. My advise: DON'T use it...
------------------------------------
what is exit sub in delphi
(skip all the sub)

This is the exit command but again, this command would get you fired if I was your boss. This command can easily be avoided in Pascal too, just by writing more structured code.
------------------------------------
how to totally exit all the application?(not just one form)

Normally, you would close the mainform or call Application.Terminate. And no comments about the use of these commands. You can also use the command Halt() which allows you to return a number to the process that called your application.
------------------------------------
how to Unload a form not just hide it?

Call the Close method, or the Release method of the form, not the Free method. Thus: Form2.Release;
When you call Release, Delphi will allow the form to handle some messages if there are still a few reserved for the form. Otherwise, those messages might end up doing nothing. Remember that the form variable will be invalid after you released it. You would have to create the form again to get it back. Form2 := TForm2.Create(Application);
If you use the Close() method then you must assign caFree to the Action parameter of the OnClose event of the form, else it's just hidden, not closed.
------------------------------------
how to know all the procedures of a specific component.
Like Forum, if you click (dblclick) you will get
procedure TForm1.FormCreate(Sender: TObject);
but how to get
procedure TForm1.FormDestroy(Sender: TObject);
and other things?

When you're in the object inspector that displays those events, just double-click on one of them and it will create the template code for you. Then all you need to do is fill it in before you save it.
------------------------------------
and what is Text1_KeyPress? and what is the ENTER BUTTOM
ie. how to lanch a procedure when someone clicks enter in a edit box?

Delphi has three events: OnKeyDown and OnKeyUp that respond when a key is pressed or released and finally the OnKeyPress which is called whenever a key is pressed and a character is generated that must be acted upon. TheOnKeyPress is closest to Text1_KeyPress in functionality.
To set a button to respond to the <Enter> key, go to the properties of the button and set the "Default" property to True. For a default cancel button that responds on the <Escape> key, set the "Cancel" property to true. But remember, a form can have only one key responding to <Enter> and one key responding to <Escape>, although this could be the same key. Otherwise, it is unclear which button will be activated.
------------------------------------
whats the difference between Complie Project1, and Build Project1.
When you compile a project, Delphi just compiles any unit that is affected by the changes you've made. If all you did was move a button on your main form, then this generally means that Delphi only compiles your main form and the project *.dpr file. When you build the project, Delphi will compile ALL units used by your project (except the VCL units) no matter if they have been altered or not. If you replace a unit source in your project with an older copy of the source then Delphi won't notice the change on a compile, but the build will force it to compile the unit anyway.
------------------------------------
And what are these in Delphi:
App.Path = STRING
App.TaskVisible = Boolean
app.Title = STRING

App.Path = Application.ExeName which equals ParamStr(0). App.Title would be Application.Title and App.TaskVisible might not have a Delphi equavalent. It could be Application.Active but I'm not sure.
------------------------------------
In VB I used to creat a model and put the public subs and functions I creat there, where should I put the public subs and functions?

Well, if those procedures and stuff aren't related to a form, frame or datamodule then you can just create a new unit for your project. (File/New/Unit) This generates something like this:

unit Unit2;
interface
// Type here your types and function headers and perhaps global variables.
implementation
// Type here the definitions for the stuff defined in your interface part.
end.

As I can see, you need to learn quite a lot. Find a good Delphi book to help you, because that might be easier than just wait here until some expert finally decided to answer... :-)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:deathman5
ID: 12465511
This is not working... why? I want when enter is pressed in Edit2, the

procedure of Button1Click to be lanched.

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    begin
      // ENTER was pressed
      TForm1.Button1Click;
    end;
end;
-----------------------------------------------

you still didnt get me
  private
    { Private declarations }
  public
    { Public declarations }
  end;

these are for declarations only right? I want to put a public sub/procedure
like this one

procedure DoYourJob(Delimiter: Char; S: string; const SS: TStrings);
begin
// Job
// More Job
//MessageBox
//ShowMessage
//AssignFile
//Kill
// If statments
//Many More Commands
//Just Like Any Procedure
end;

where and how to put it???
0
 
LVL 7

Expert Comment

by:sftweng
ID: 12465770
Double-click on the OnKeyPress event for the TEdit, while designing. This will create the declarations and the event handler code skeleton.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 12467205
If you're too cheap to get a Delphi book, read the help file, Everyone of those questions
are simple first day of class type of stuff that even casual perusing of the help file will give
you answers to.
0
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 280 total points
ID: 12467243
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
    begin
      Button1Click(Sender);
    end;
end;

--------------------------------------------------------------------------------------------------------------------

  TForm1 = class(TForm)
  private
  public
     procedure DoYourJob(Delimiter: Char; S: string; const SS: TStrings);
  end;

  implementation

  procedure TForm1.DoYourJob(Delimiter: Char; S: string; const SS: TStrings);
  begin
    // Job
    // More Job
    //MessageBox
    //ShowMessage
    //AssignFile
    //Kill
    // If statments
    //Many More Commands
    //Just Like Any Procedure
  end;
0
 

Author Comment

by:deathman5
ID: 12474883
Thank You All For Everything.
Sorry if my questions where silly, but even if they were, you are getting points to answer arent you?
;-)
thanks agian.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12475634
I've answered sillier questions than these ones. :-)
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12476488
:))) Me too. deathman5 don't worry, we are here to help each other. If I understood correctly, you are migrating to Delphi, so have time to catch up with us. Good luck :)
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12492561
Catch up with us? I have 20 years of Pascal experience, of which the last 10 are focused on Delphi. It would take him a lot of effords before he finally catches up... ;-)
0
 
LVL 7

Expert Comment

by:sftweng
ID: 12492991
Time spent doesn't equal capability. :-)

I've been working with the Pascal family of languages since about 1978, a few more than you, and I have always enjoyed hiring people whose prowess quickly supassed mine. Of course, I'm not just a programmer, so I don't over-specialize.

0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12494833
Guys, you are really old .... :)))))) I am only 22. Registered here from April this year, total programming experience - 10+, professional 4+. Correct me if I am wrong, but I think the new guy can become middle level developer in Delphi for 2 years.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question