In this entry I’m going to create a simple form that shows how to add items to WComboBox in two different ways. The first one is useful for static combo items while the second one might be used to populate a combo from a database.
The code is based on our previous Hello World application. There are few lines that changed.
Using Static Combo Items Adding items to a WComboBox is just a matter of calling the addItem method.
In this entry I’m going to create a simple form. This form will show you how to use controls and events in a very simple way.
A couple things you have to notice before we start:
I’m going to inherit from WContainerWidget. As you now know, I could have inherited from WApplication too. Most controls like, WLabel, WLineEdit and WPushButton include a “parent” parameter in their constructors. But you can also create them and add them later to any WContainerWidget.
Let’s start by talking a little bit about some elements and methods you will find in the code.
Inheriting from WApplication or WContainerWidget are the most common ways to start an application using Wt. A WApplication instance will be in charge of creating your html, head and body tags. A WContainerWidget is usually a div tag (it can also be turned into a ul or ol by using its setList method).
Installing Wt can be a challenging task if you don’t have the right tools. I spent many days trying to make it work with MinGW and Visual Studio 2005. No luck. Here are some of my results:
MinGW I was never able to make a full compile. It was interrupted by this or that reason. I could never get any of the examples to work.
Visual C++ Express 2005 Some of the examples worked, however only in “Release” mode.
Boost is a set of high-quality libraries that speed up C++ development. They are included in most linux distributions and some of them are already part of the C++ Standard Library. In the Windows environment, you have to install them in order to take advantage of them.
If you are using Microsoft Visual Studio, you can avoid the following steps by downloading a binary version from http://www.boostpro.com/download/and skip to the Testing section in this document.
C and C++ languages are everywhere. All operating systems use them. People usually choose them because of their limitless power, velocity of execution, great portability and much more. In this tutorial I will show you how to install a C/C++ development environment under Windows. By the way, MinGW includes other compilers for languages like c, c++, objective c fortran and ada.
Install MinGW Go to the MinGW websiteand look for the download link.
Unlike Microsoft’s Visual Studio, the option to switch from Debug to Release in Delphi is kind of hidden. However, it is very easy to use.
Go to the Project menu and select Configuration Manager Now select your project, Choose a new configuration and Press the “play” button. The following picture shows you how the Configuration Manager looks: By default, the difference between the Debug and the Release options include:
One advantage of Delphi’s dynamic arrays is that they are automatically freed once they go out of scope. That simplifies memory management and gives you more flexibility on your applications.
You can declare a dynamic array like this:
Customers: array of string; Before adding an element, you have to call the SetLength function to specify the number of elements you are going to use (3 in this case):
SetLength(Customers, 3); Now you can go ahead adding values:
Multithreading is one of those operating systems feaures that make your programs work in a more efficient way and give your users a better interactive interface. However they are not used by all developers.
In this article I will focus on some important points you must have in mind when using threads on Delphi.
How to create them There are two simple steps to accomplish it:
Create a new class that inherits from TThread and Override the Execute method.
Shortcodes enable developers to create special kinds of content, following the idea of macros. One very famous short code is “gallery” needed to insert a gallery of images into a post.
The good thing about shortcode’s is that final users are free to decide where to insert them.
WordPress’s Shortcode API handles all the tricky parsing, making developers life much easier. The following is a snippet for a Shortcode – in order to make it work you have to add it to your functions.