Best way for a newbie to get started??

Just starting out? Need help? Post your questions and find answers here.
Gary Stout
New User
New User
Posts: 5
Joined: Mon Feb 03, 2014 12:13 am
Location: Springfield, IL

Best way for a newbie to get started??

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Best way for a newbie to get started??

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Best way for a newbie to get started??

Post 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.
Best wishes to the PB community. Thank you for the memories. ♥️
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Best way for a newbie to get started??

Post 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
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Best way for a newbie to get started??

Post 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.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 539
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: Best way for a newbie to get started??

Post 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
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Gary Stout
New User
New User
Posts: 5
Joined: Mon Feb 03, 2014 12:13 am
Location: Springfield, IL

Re: Best way for a newbie to get started??

Post 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
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Best way for a newbie to get started??

Post by Danilo »

You may also find PureBasic Survival Guide interesting.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: Best way for a newbie to get started??

Post by heartbone »

Keep it BASIC.
Post Reply