Getting Started (aka Hello World)

You’ve decided to you want to know more about Xappworks and signed up for early access, but where do you go from there? Well let’s start by creating our first application!

When you first login you’ll be presented with the home screen, this is where you’ll navigate around your applications.

Home Screen

The Home Screen

If you haven’t done so already you’ll want to create a new folder for your applications by clicking on the Object menu then pointing to New> Folder and give it a name you like, then create the new applications by going to Object then New > Application and give it a name.

Now click the folder you just made in the tree and you should see your application appear in the area on the right. If you right click on the icon a popup will appear to giving you the options to Run, Modify or Properites. We want to select Modify!

The IDE

Xappworks includes a built in IDE for creating your own applications which includes a text editor, form designer and database tools. When you open your new application it will look like this:

The IDE

The IDE

Let’s edit the default Form1.frm by double clicking on it. The default size is a little big so shrink it by dragging from the edges inward. Drag a button from the palette on the left and place it on the middle of your form. Use the properties table on the right below the panel to name the button “helloBtn” and give it the text or label “Click Me”.

Drag a textfield from the palette onto the form and place it above the button and size it up so that your form looks like this:

Our First Form

Our First Form

Call your textfield “helloTxt”, then select your button, click on the Events Tab by the properties and then edit the value for action event by double clicking and either give your event handler a name or just hit enter and it’ll be given a default name.

The code editor should appear now for Form1Module.mod. This file is used to handle all the logic behind your form. The first method is the constructor which is called just after the form has loaded, the second method is our new event handler. If you’ve gone for the default event name it’ll be called helloBtnactionEvent(event).

Between the two curly brackets (braces { } ) we’re going to add some code to make our form do something.

public void helloBtnactionEvent(event){
        myForm.helloTxt.text = "Hello, World " +  new Date();
        myForm.title ="My First App!!"
        myForm.form.background = java.awt.Color.blue;
}

What this does is sets the text of our textfield to “Hello, World” and the current date and time, sets the title of the window to “My First App!!” and lastly, sets the forms background color to blue.

Hit the save all button in the toolbar (Save All Icon in toolbar). Then press the green run button in the toolbar (Green Run Button).

That’s all for now have fun and if you have any issues let us know in the forums!

About Adam

Lead developer at AC on Xappworks
Posted in Tutorials | Comments Off

Comments are closed.