İçeriğe atla

Gambas/Merhaba Dünya

Vikikitap, özgür kütüphane

Her programlama kitabı "Merhaba Dünya" programı ile başlar. Every programming book should start out with a "Hello World" program, just to get you started. This book's author sees no reason not to follow this "standard" so we will do just that.

Yeni bir proje oluşturmak

[değiştir]

Gambas'ı çalıştırın. Bu ekran sizi karşılayacak:


Daha sonra aşağıda tarif edilen adımları takip edin:
"New Project"'i tıklayın:
"Next"'i tıklayın:
"Create a graphical project"i seçin:
"Next"i tıklayın:
"Select the name of the project"e Hello_World girin
"Select the title of the project"e Hello World girin
Projeyi oluşturmak için "Ok"i tıklayın

Form (pencere) oluşturmak

[değiştir]

Ok, now we should have gambas started with a fresh, new project. You are now looking at the Gambas GUI, which is where we will do all our Gambas work. When you look at the interface, it seems pretty useless; No windows, No buttons or what have you. Let's change that right away.
On your left side, you'll see a tree view, right click on the Forms folder, and choose "New --> Form"(the --> indicates that you choose New, and follow the submenu to Form).

In the Create form dialog, just click "Ok".
As you noticed, quite a few things happend. A new Form(Window) was created, and some other new things showed up. /*NOTE*/In gambas "Windows is called "Forms" and I will use the term Form(s)in the rest of the book.

The grey Form that just got created looks a bit ugly(tiny dots all over the place) but don't worry about that. The dots are there for your aid in placing your objects in the Form.
To your right you should see the "ToolBox". That's where you can choose what objects you want in your form. In our "Hello World" program, we'll need one label(marked as "A" in the toolbox) and one button(marked as "Ok" in the toolbox). Let's start with the label. Click on the label in the toolbox, and move the the new form. In the form, hold down the left mouse button, and "draw" the label on there. Once done, you will have a label in your form with the text "Label1" in it. Now you can change this text with the "Hello Word" phrase.

The next step is to put some code in the Ok Button (you must chage the text to "OK" of this button as you changed in the Label). After changing the text please double click the button so we can enter the exit code in the event click of this button. Type QUIT in the click event and that's all you've created your Hello World Application

index