A Hello and a Question
-
- User
- Posts: 20
- Joined: Thu Mar 18, 2021 6:26 pm
A Hello and a Question
Hi all,
My TwoCatsYelling (you can call me Cats :p). New to PureBasic; just purchased my copy earlier today. I'm eager to jump in and learn!
I'm very new to programming. Have tried a variety of languages, followed some introductory tutorials, and learned the basics (variables, functions, etc). Long story short, I found my way to looking into BASIC, and then found PureBasic, and here I am.
So!
Something I haven't found, yet, are introductory tutorials. The ones I've found jump straight into programming applications that I think would be a bit beyond me at this point (the image viewer, and snake game). Other languages I've looked into have a series of videos that give a more formal introduction to the language structure and such, usually including some basic programs to show how things work, etc. Haven't been able to find anything like that for this, though.
So I was wondering if anyone can point to some good, basic tutorials, to at least get me rolling in the right direction?
Thanks a bunch!
My TwoCatsYelling (you can call me Cats :p). New to PureBasic; just purchased my copy earlier today. I'm eager to jump in and learn!
I'm very new to programming. Have tried a variety of languages, followed some introductory tutorials, and learned the basics (variables, functions, etc). Long story short, I found my way to looking into BASIC, and then found PureBasic, and here I am.
So!
Something I haven't found, yet, are introductory tutorials. The ones I've found jump straight into programming applications that I think would be a bit beyond me at this point (the image viewer, and snake game). Other languages I've looked into have a series of videos that give a more formal introduction to the language structure and such, usually including some basic programs to show how things work, etc. Haven't been able to find anything like that for this, though.
So I was wondering if anyone can point to some good, basic tutorials, to at least get me rolling in the right direction?
Thanks a bunch!
Last edited by TwoCatsYelling on Thu Mar 18, 2021 8:27 pm, edited 1 time in total.
Re: A Hello and a Question
Hello Cats and welcome to PureBasic!
There are many resources and you could look >> here << for example. Click the Tutorials button. There are even free beginner books
There are many resources and you could look >> here << for example. Click the Tutorials button. There are even free beginner books

- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: A Hello and a Question
Or here in your sofa, to see good movies on your TV with popcorns
https://www.youtube.com/channel/UCseEtp ... j4w-MDbhDw

https://www.youtube.com/channel/UCseEtp ... j4w-MDbhDw

Not a destination
Re: A Hello and a Question
You may take a look into "We start programming".
Or you may even download a complete book about PureBasic:
"PureBasic - A Beginner's Guide To Computer Programming"
Or you may even download a complete book about PureBasic:
"PureBasic - A Beginner's Guide To Computer Programming"
-
- User
- Posts: 20
- Joined: Thu Mar 18, 2021 6:26 pm
Re: A Hello and a Question
I did find that book (after I posted the message... of course!), but I did not know about the "We Start Programming", so I have that bookmarked, too. At a glimpse, that looks like exactly what I was looking for.Shardik wrote:You may take a look into "We start programming".
Or you may even download a complete book about PureBasic:
"PureBasic - A Beginner's Guide To Computer Programming"
Thanks!
-
- User
- Posts: 20
- Joined: Thu Mar 18, 2021 6:26 pm
Re: A Hello and a Question
Hello!Kwai chang caine wrote:Or here in your sofa, to see good movies on your TV with popcorns![]()
https://www.youtube.com/channel/UCseEtp ... j4w-MDbhDw
I started going through some of those videos and then realized they seemed a bit beyond me at this point. But I'm definitely going to return to them when I feel more familiar with the language. This way I can follow along and better understand what he's doing.
Thanks!
-
- User
- Posts: 20
- Joined: Thu Mar 18, 2021 6:26 pm
Re: A Hello and a Question
Well that's a treasure trove!Bitblazer wrote:Hello Cats and welcome to PureBasic!
There are many resources and you could look >> here << for example. Click the Tutorials button. There are even free beginner books
I wish that had come up in my searching. Gonna bookmark and dive right into that.
Thanks!
Re: A Hello and a Question
This might be a good start:TwoCatsYelling wrote:...some good, basic tutorials, to at least get me rolling in the right direction?
> The Basic Anatomy of a PureBasic Program
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

-
- User
- Posts: 20
- Joined: Thu Mar 18, 2021 6:26 pm
Re: A Hello and a Question
Thank you!TI-994A wrote:This might be a good start:TwoCatsYelling wrote:...some good, basic tutorials, to at least get me rolling in the right direction?
> The Basic Anatomy of a PureBasic Program
I followed it fine up 'til the very end, where we create the form version of the window, to grab the text from the Text field and place it in the Label field.
The button doesn't do anything when I click on it.
I double-checked, and even copied and pasted their exact code, with the same results. Also, one of the options they instruct to set in the form preferences wasn't there. So, I'm guessing it's another case of something changing in the language since that was written (almost 6 years is a long time). The the non-form version of it worked fine.
That's okay though. I don't intend to be using forms just yet. So, when I get to that, I'll figure out how it should work.
Re: A Hello and a Question
In the code (from this tutorial), clicking the button will change the label text to the string entered in the text box.TwoCatsYelling wrote:... The button doesn't do anything when I click on it.
* Enter some text into the empty StringGadget() > Press the ButtonGadget() labelled "Click Me" > The content of the TextGadget() changes to the input text.
Code: Select all
wFlags = #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget |
#PB_Window_SizeGadget | #PB_Window_ScreenCentered
OpenWindow(0, 0, 0, 300, 200, "My Window", wFlags)
TextGadget(1, 50, 30, 200, 30, "This is a label...")
StringGadget(2, 50, 70, 200, 30, "")
ButtonGadget(3, 50, 120, 200, 30, "Click Me")
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget
gadget = EventGadget()
;if the button is pressed (identifier = 3)
If gadget = 3
;get the text from the text box (identifier = 2)
text$ = GetGadgetText(2)
;and place it in the label (identifier = 1)
SetGadgetText(1, text$)
EndIf
EndIf
Until event = #PB_Event_CloseWindow
Yes. That form option was removed about a year after the tutorial was posted.TwoCatsYelling wrote:... Also, one of the options they instruct to set in the form preferences wasn't there. So, I'm guessing it's another case of something changing in the language since that was written (almost 6 years is a long time).
PureBasic Manual - History wrote:1st March 2016 : Version 5.42 LTS
- Removed: 'generate event loop' option in the Preferences/Form
Essentially, by selecting that option, the following event loop would be generated within the form code, along with the call to the OpenWindow_0() procedure:
Code: Select all
OpenWindow_0()
Repeat
event = WaitWindowEvent()
Until Window_0_Events(event) = #False
MyFormEvents.pb
Code: Select all
XIncludeFile "MyForm.pbf"
Procedure buttonEvent(eventType.i)
;get the text from the text box (identifier = String_0)
text$ = GetGadgetText(String_0)
;and place it in the label (identifier = Text_0)
SetGadgetText(Text_0, text$)
EndProcedure
MyFormEvents.pb
Code: Select all
XIncludeFile "MyForm.pbf"
Procedure buttonEvent(eventType.i)
;get the text from the text box (identifier = String_0)
text$ = GetGadgetText(String_0)
;and place it in the label (identifier = Text_0)
SetGadgetText(Text_0, text$)
EndProcedure
OpenWindow_0()
Repeat
event = WaitWindowEvent()
Until Window_0_Events(event) = #False
Last edited by TI-994A on Tue Mar 23, 2021 1:16 pm, edited 1 time in total.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

Re: A Hello and a Question
@TI-994A
maybe this line should be changed to 
maybe this line
Code: Select all
If #PB_Event_Gadget
Code: Select all
If event = #PB_Event_Gadget

Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: A Hello and a Question
Good catch! The code was originally adapted from a Select/Case block, and the event check was clearly missed. It's a fluke that the logic works. Thank you.Axolotl wrote:...should be changed toCode: Select all
If event = #PB_Event_Gadget
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
