Tuesday, March 1, 2011

how to programing to delphi for php ?

div dir="ltr" style="text-align: left;" trbidi="on"
link href="file:///C:%5CDOCUME%7E1%5Cuser%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" rel="File-List">Figure A). There is a main window for code (which is initially occupied with links to open previous projects and files, news pieces, and so on), surrounded by toolboxes, project management windows, property viewers, and a code structure window, with a tabbed status/debugging window at the bottom.
When you start a new project, you will be asked what kind of project to start. For this example, I chose a new Application. This allows us to work with a completely blank slate project (Figure B). As you can see, the main work area is divided between a grid layout of the page and a source code view of the page. The toolboxes now contain information as well.

Getting down to business

Let’s take a closer look at the Object Inspector (which is used to edit the properties, events, and JavaScript of objects), where much of the action takes place (Figure C).
Again, this will look familiar to users of other IDEs. In this case, I will change the value of the Caption property from Unit1 to Test Page. As soon as I do, the tag in the generated code is now changed to Test Page (Figure D) The reason for this is, the caption property was part of the page itself, so it maps to the tag of the page.
It’s interesting that the code displayed is generated directly from the object’s properties and cannot be modified. While this may frustrate many users, the reasoning behind it is to eliminate odd discrepancies between the user’s handmade changes and changes made in the IDE.
As expected, you can drag and drop controls from the toolbox (called the Tool Palette) onto our page. In this example, I will place a text box and a button on the page. I can select the controls on the page with the mouse and use the Object Inspector to modify the associated properties, events, and JavaScript. The difference between Events and JavaScript is that Events handles things that occur server-side and JavaScript items are run on the client side. The OnClick event of a button, for example, is run on the server when a postback occurs as a result of clicking the button. So an object with JavaScript for OnClick and an event handler for OnClick would run the JavaScript, perform the page postback, and then run the event handler code on the server. Double clicking an object in the designer will take you to that object’s default event handler and create an empty event handler if you have not already made one.

Making it look good

The final piece of the puzzle is to make the page look good. To do that, I will attach a stylesheet by first creating a style sheet and adding it to the project. From the File menu, choose New, choose Other in the resulting dialog box, select CSS in the tree on the left, and then click OK. If you have an existing stylesheet that you would like to add to the project, you can do so through the Project menu.
Once you add the stylesheet to the project, it is easy (but not obvious) to add it to the page. In the Tool Palette, you scroll down to the System group, select the StyleSheet control, and drop it onto the page. After the stylesheet is added to the page, you can select it and change the FileName property of the control in the Object Inspector to the name of your stylesheet. Once it is added, you will see that the Style property of the controls on your page has a drop-down list populated with the styles in the stylesheet. You will note that the Style property will not include any styles that do not apply to that type of control.

The code model

Delphi for PHP formalizes the potential “division of labor” between the presentation and the business logic. In PHP, it is possible to put all of the processing code embedded into the HTML code. But a good number of PHP developers choose to separate their code, putting all of the logic in a separate file and then including it in the file that is officially the page. In Delphi for PHP, there is a complete and formal separation between the code used for the presentation, and the code used for the logic.

No comments:

Post a Comment