When to use Control and Components

Notice: This thread is very old.
unagi2020
Member | 18
+
0
-

I have being reading about components and controls but am not sure about the best practices of using them for widgets. Could someone please guide me ?
I am planning to develop following basic widgets for a site … please help me
Tabs,
Recent Posts,
Sidebar and Header Login,
Search,
Recent Posts,
Service Status – Will automatically refresh data every 5 seconds,
Data Grid,
Auto Complete,
Drag and Drop

Thanks for looking at this post,
Unagi.

Last edited by unagi2020 (2011-02-14 20:29)

Jan Tvrdík
Nette guru | 2595
+
0
-

I'm not sure what you already know about components, so I start with the basic.

component is every class which implements the interface IComponent. The default implementation of this interface is the class Nette\Component.

control is every class which extends Nette\Application\Control, which is a special type of component designed for direct usage in presenters (has for example method link and supports signals [interface ISignalReceiver]) with support for normal rendering (has template factory) and partial rendering (interface IPartiallyRenderable, used for AJAX).

So all the “widgets” you have mentioned should be instance of Nette\Application\Control.

Feel free to ask me additional questions.

unagi2020
Member | 18
+
0
-

Got it. Thank you.