Component Writer's Guide :: Introduction

From RadPHP XE2 Documentation
Jump to: navigation, search

Using this guide, you will be able to write components to be integrated into RadPHP IDE as part of the RPCL. Components can be written in pure PHP, but for some specific tasks in the IDE, you will need to write Delphi for Windows code.

The IDE is able to render PHP components that follow an specific structure, to render a component, the PHP code that make up the component is generated and executed, to get HTML+JS.

PHP components cannot only produce HTML code, but can render an image bitmap (for graphic components, like charts), in this case, the IDE treats them a bit differently, because the output that is generated is binary information, and not HTML code.

PHP components can have also no image to render, that is, be non-visual, in this case, when a component descend from Component but not from Control, the IDE shows a 32x32 pixel button with the component icon.

When saving a form to disk, component bitmaps are stored on the user temp folder, to load a form faster the next time, if no bitmap file exists, the component get rendered again. You can safely delete that folder, it's used just for caching purposes.

While rendering components, php errors are handled and shown on the messages window, so you can easily fix the problem.

In specific cases, your component may need to specify the encoding to be used for the HTML produce, this can also be specified using control styles.

After the component is rendered by the IDE, properties are updated with the updated values from PHP, so it's possible to modify them in PHP code to reflect some change, the best example is the ScrollBar and the Kind property, when changing from Horizontal to Vertical or viceversa, Height and Width are updated from PHP code

Components can also contain subproperties, like Font, these subproperties are handled in a special way when generating the PHP code, so only 1 level of subproperties is supported. These properties are shown as nested by the Object Inspector.

Components can specify which types of components, on the same form, want to get rendered along with them, so they have a reference to them, this feature is used by the StyleSheet component.

Some components may need extra time to get rendered in IE, specially if make heavy use of javascript, if that's the case, you need to instruct the IDE to spend more time redrawing the component by setting the csSlowRedraw style on the ControlStyle property. An example is the DBGrid, which takes a more time to get generated than a simple Button.

Personal tools