And now you can forget everything you know about Objective-C programming, because there is GNUstep. While not entirely true, this section will explain why I. This tutorial introduces you to the GNUstep make package; this package allows you to easily create and manage portable GNUstep projects. It is probably the. Eventually, we’ll want to go a bit further than this, compiling and testing Objective- C on Windows and I’m looking at GNUStep or using Xcode on.
|Published (Last):||6 March 2011|
|PDF File Size:||12.52 Mb|
|ePub File Size:||13.56 Mb|
|Price:||Free* [*Free Regsitration Required]|
Creating an App Launch ProjectCenter.
gnustep-tutorial package : Ubuntu
In the “New Project Select the location of your applicationgive it a name here we chose gnistep and press OK. Editing gnusrep interface file Select Interfaces in the main window browser. The project interface files will appear. Depending on the version of ProjectCenter you might find tnustep versions of the interface renaissance markup, for example.
That should launch Gorm automatically and open the file. Gorm first contact Here is what you’ll get once you’ve double-clicked the. If the Palettes and Tools don’t display automatically for you, show them using: Then you’ll see the Palettes and Insepector windows. The Palettes Window contains many palettes.
Each of the palettes contains components which can be drag-and-dropped to the interface window. A Window will be instantiated and shown.
Rename the title of “My Window” to, for example, “Converter”. To do that, check in the Inspectorthe Title property. Change it to the name you need e.
Converter and hit enter.
The title of the instantiated Window will automatically change. You may also want to change the name of the Window Object. Although this does not have effect for the user interface, it helps when having many windows and objects instantiated to identify the correct one.
Set it to something like MainWin: In the Attributes of the Window also tick the Visible at launch time Option. This will show the window automatically when the application is launched. Creating the interface Try to drag-and-drop some Text, Title and Button components to the Converter window. Drag the items you need from the Palette Controls Palette. Move things in order to obtain an interface that looks close to tutorjal following one.
Resize the Controls and the window using the Handles. You can change the values of the control strings by directly double-clicking and doing in-line editing. Don’t forget to press “Enter” or to click OK once you’ve finished editing the value.
Change the string values of the components to obtain the following. You can readjust the sizes to match the new labels, guidelines will appear to help you aligning the elements and you can also use the arrow keys to do precise movements. Creating a subclass Now select the “Classes” part of the main window. It will be called “NewClass” You should then see the following inspector window. Rename the class from NewClass to ConvertorManager don’t forget to press Enter, or your change will not affect anything.
Outlets are basically instance variables of the class that you will connect to interface’s components at design time. Outlets represent the components you want to work with and of which you need to work in the code. Connecting them means interfacing the code with the gorm interface. So add three outlets: Adding an outlet creates a new outlet called newOutlet: You will now create an action.
An action is an object method which can be linked to interface’s component at design time, so that a specific action on the component will get this method to be called. Actions specify interaction from the interface to the code, they are methods to which the interface will send messages. Actions carry as a parameter a sender which is the control generating the call. Add one action named “convert: Instantiating the class Now that we have defined the class’s outlets and actions, we need to instantiate it.
You should now see a new object ConvertorManager in the Objects part of Gorm’s main panel. Connecting outlets and actions We now need to connect the outlets of the instance of ConvertorManager we have created to their corresponding components.
As you may have guessed, the amount outlet is to be connected to the first text field, rate to the second and result to the third. Done that, the ConvertorManager instance will be able to access those fields by using its instance variables. You will not have any code to write to have those connections up and working.
To connect the amount outlet to the first text field, you have to drag-and-drop while pressing the Control key from the ConvertorManager instance the instance is in the Classes part of Gorm’s main panel to the first text field. Little S and T icons will appear showing who is the Source and who is the Target those icons always appear in the bottom-left corner, if they are not then you are probably not selecting the component you want to select. After drag-and-dropping, you have to select which outlet of the Source you want to connect to the target, do this by clicking the correct outlet in the Outlets column of the Inspector and by pressing the connect button.
Do this for all three outlets amount, rate, result. Connecting an action is a similar operation. Do a drag-and-drop with the control key pressed, from the Convert button to the instance of ConvertorManager. Then click target in the Outlets part of the inspector, all available actions of the target here the ConvertorManager instance which has only one action will appear in the Actions column.
GNUstep development tools : a basic tutorial
Click on the convert: Yutorial sender will be the Button. Creating the class’s source and header files Gorm. Two successive Save Panels will pop up for the. Gorm will propose as file names ConvertorManager. Save those files into the Project directory. You may also safely delete the “AppController” object instance if you have it in your Gorm file.
gnustep-tutorial package in Ubuntu
Once this is done, remember to save the interface if you haven’t yet, and go back to ProjectCenter. Adding the class’s source and header files to the current gnusetp You now need to add the class’s files to the project.
Double-click “Classes” in the first column of the browser, choose the. YOu can display the file in the embedded view or, alternatively, double-clicking will open it in a separate editor. You should see the following: You may safely remove the AppController class from your tutoiral, we are not using it.
Compiling and running Click to dispay the building panel. Then click to build the project. If there is no errors and hopefully there is noneyou can run the application.
To do it, click to display the run panel. Then click the first button at this time it has still no iconthis should launch the application: Congratulations, you have made your first GNUstep application.