Page 1 of 1
Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 5:06 pm
by Gary Stout
I am brand new to PureBasic and looking for ideas on the best way to get my feet wet, so to speak. I have been a long time user of another compiler and visual designer and now is the time to explore other options. I have been a Linux user since about 2006 or 2007 and have longed for a way to create in-house programs for Linux, so the whole cross-compiling options in PureBasic sound great!
I have played around a little with the PB visual designer, but haven't figured out how to put code behind a button, for instance.
Are there any recommended tutorials for someone just starting out?
Thanks for your help and suggestions!
Gary
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 5:33 pm
by ts-soft
You can found some tutorials and books at:
http://www.purearea.net
You can found many examples in the installationsdir from purebasic and in the helpfile.
You can found many help here in the forum!
But it is not a good idea to beginn with a Visuell Designer without the basic principles of PureBasic.
Greetings - Thomas
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 5:58 pm
by Kuron
How to do almost anything in PureBasic:
http://www.purearea.net/pb/CodeArchiv/English.html
It is for an older version, but you can download that older version to work with and just apply what you learn to the new version tweaking any necessary changes.
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 6:00 pm
by BorisTheOld
Hi Gary -- so you're taking "the big step".
Just today I finally pulled the plug on that "other compiler and visual designer". So after two years of planning and three years of conversion I'm now 100% cross-platform PureBasic, running on Linux Mint. No API and no support DLLs.
It's been an interesting journey, but I must confess that my code is better for the change. Having all the features I need, in a single cross-platform language, will make my life a lot easier. Until now I've been actively coding in COBOL, MASM, PowerBasic, FreeBasic, and EZGUI.
I suggest you just dive in and start coding. There's a bit of a learning curve getting used to the syntax, but it all makes sense after a while. I found the forums to be the best place for information. You'll also find links to stuff on other web sites.
As ts-soft suggests, learn the language before you use the Visual Designer. I prefer to code without benefit of a visual designer, as they are never as flexible as I would like them to be.
Rod Gobby
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 6:25 pm
by c4s
Gary Stout wrote:Are there any recommended tutorials for someone just starting out?
Check out the "
We start programming" chapter in the help file. Read through all pages of it and you'll get a good understanding of how PureBasic works.
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 7:25 pm
by BasicallyPure
I would agree that is best to avoid the form designer until you have gained some experience first.
It will likely lead to confusion.
I find it very useful if you have many gadgets on your window then it is very helpful to get them arranged in
a nice way.
Gary Stout wrote:I have played around a little with the PB visual designer, but haven't figured out how to put code behind a button, for instance.
Here is a simple example (without using the form designer) to create a window with buttons
and react to each button click.
Code: Select all
; simple example using button gadgets
EnableExplicit ; I highly recommend using this compiler command
; define constants
#WinMain = 0
Enumeration ; automatically assign numbers to constants
#Btn_1 ; = 0
#Btn_2 ; = 1
#Btn_3 ; = 2
EndEnumeration
Procedure PROCESS_BUTTON_1()
Debug "button 1 clicked"
EndProcedure
Procedure PROCESS_BUTTON_2()
Debug "button 2 clicked"
EndProcedure
Procedure PROCESS_BUTTON_3()
Debug "button 3 clicked"
EndProcedure
; define variables for main body code
Define Quit.i ; as type integer
Define flags.i = #PB_Window_ScreenCentered | #PB_Window_SystemMenu
If OpenWindow(#WinMain,0,0,340,50,"Example",flags) = 0 ; 0 indicates fail
MessageRequester("Error!","Unable to create window.")
End
EndIf
; create the button gadgets
ButtonGadget(#Btn_1,010,10,100,20,"Button 1")
ButtonGadget(#Btn_2,120,10,100,20,"Button 2")
ButtonGadget(#Btn_3,230,10,100,20,"Button 3")
; process all window events, act upon those of interest
Repeat
Select WaitWindowEvent() ; waits for any window event to occur
Case #PB_Event_Gadget ; indicates the event was from a gadget
Select EventGadget() ; identifies the gadget that fired the event
Case #Btn_1 : PROCESS_BUTTON_1()
Case #Btn_2 : PROCESS_BUTTON_2()
Case #Btn_3 : PROCESS_BUTTON_3()
EndSelect
Case #PB_Event_CloseWindow : Quit = 1
EndSelect
Until Quit = 1
End
BP
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 7:39 pm
by Gary Stout
Thanks everyone for the suggestions and links. I am going to dive in head first and see what I can learn!
Gary
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 8:32 pm
by Danilo
You may also find
PureBasic Survival Guide interesting.
Re: Best way for a newbie to get started??
Posted: Wed Feb 05, 2014 11:18 pm
by heartbone