Page 1 of 2
my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 2:07 am
by oldefoxx
I'm into my first (in years) PureBasic programs. Not yet writing my own,
mind you, but exploring other ones. I'm using Google Translate to change
the ones in German into English so that I can understand them. You can't
do the whole program over, but you can translate the comments using a
copy and paste method.
I also found quite a bit in PureBasic related to using the Console. I've sort
of gotten into seeing what I can do with Console while using PureBasic. It's
been a strong part of my programming past, and likely to be of interest to
anyone that once did a lot of DOS programming. I used this method at the
command line to find out pretty much everything that PureBasic as on the
use of the Console, which turns out to be a good bit:
dir \purebasic\console*.* /s | more
But while working with one of the programs, I came on to something
interesting: There was a place there where a constant would have served.
But when I tried replacing the code with the constant in mind, it would not
compile because the constant was unknown. I thought surely that this
should be a constant, but then I found out there are no predefined constants
except the ones that begin with #PB_. That's fine, but there is no reference
that I can find in the Help file that lays out all the #PB_ constants. And I've
run into #PB_Any and a few other #PB_ cnstant uses for something to jog up
in my memory that reminded me that once I knew because of something I
had read that all PB Constants begin with #PB_. I don't know where that
information came from originally.
As to the ability to define constants, it might be spelled out that constants can or
cannot be used to represent strings and/or numerical values, and that some
common constants might be #CRLF = Chr(13)+Chr(10) , #DQ = Chr(34) with
#TAB = Chr(9), #SPACE = Chr(32). Then there is the purpose served with the
Insert, Delete, and Backspace keys, which are not usually equated to their
actual ASCII codes. Oh, I did find the ASCII code table, which is good.
And you have the Shifts, Capslock, Alternate, and Control keys, plus the Menu,
and MS keys, along with the function keys. Then add in the the other remaining
keys on the keyboard, aside from the ones that produce write symbols, and you
have a bit of a gap between the keyboard and just the ASCII table. Thought it
was worth mentioning.
get into using the keyboard that much,
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 3:00 am
by jack
oldefoxx, in the PB Ide click on tools-Structure Viewer, there you can view PB Structures and also PB Constants, as for translating code from the German forum perhaps this tool would help
http://www.purebasic.fr/english/viewtop ... 14&t=50324
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 3:30 am
by oldefoxx
Hey, that's good to know. Would never have thought to look in a place
like that. Let me give it a try. Yep. Man, that's a HUGE list. I searched
to see if I could find #crlf, the constant I had tried to use earlier. It's
there, but with a $ at the end (#CRLF$). I also note it is capitalized.
Now I have to wonder if capitalization makes a difference with
constants. I guess that is some more testing to find out.
First time I looked for #crlf, I scrolled the "C" category. Second time I
was smarter and entered #crlf in the box at the bottom and got to it that
way right away.
I changed my method of searching for PureBasic files that have Console in
their names. I tried using this instead:
dir \purebasic\*console*.* /s | more
The leading * meant that I turned up some additional ones that I missed
before. If you what to actually to get a list to work from, try this instead:
dir \purebasic\*console*.* /s > tempfile.txt
when you get your prompt back, you can print out tempfile.txt or use
something like Notepad to bring it up and work from it. The > symbol acts
like a "pipe", to pass the output from the dir command over to then be input
for a new file named tempfile.txt. Tempfile.txt will appear in whatever your
current directory is. The vertical bar (|) before "more" (located above the Enter
key on the keyboard) is another type type of "pipe", as is <, and >>. That's a bit
of DOS coming into play there. Still usable at the Command Line prompt from
Windows. You can't do this type of search and find from Windows itself, because
the search tool there wants to search whole drive(s), which takes a lot longer
and may turn up a lot of unrelated files. In my case, I just wanted the ones that
came up under PureBasic. The dir command gives me that option, even though
it is old school.
Unfortunately, while the method you just explained to me works, you cannot find this
information under the Help system. And for functions related to CONSOLE, I could
only search out the ones that began with Console. That leaves out the ones like
OpenConsole(), CloseConsole, ClearConsole() and EnableGraphicalConsole(). IMHO
the search could be expanded if the Search tool used FindString() and it was made
case insensitive. (LCase() to LCase() or UCase to UCase()).
Overall, though, I would say that I am gaining in my favorable impression of
PureBasic. It shows a long history, the efforts of many very capable people, and
puts some other BASICs to shame by comparison. I say that with a bit of hesitation,
because there are some good BASICs out there. It really gets down to what you
want and need again.
One thing that some other IDEs do that can help someone get into writing a program
is the use of templates. A template is just a short sequence of instructions that
tend to make a small effort to identify the type of program being created or
contemplated. If it is going to be a GUI program, certain steps can be laid down to
this end. If it is to become a DLL, there are other steps to take. If you want to
produce a dyed-in-the-wool OBJ file, there would be something else. If you wanted
to produce an Include file, there are other considerations. And of course one of my
favorites, a Console application. In other words, instead of starting off with a 1 and
a sequence of digits down the left side, there is already something there to act as
a catalyst to bring the programmer out in people when they don't even know that
they have it in them.
Oh, a late thought. Some game templates, for those that want to follow that path.
Give them a start, and let them find out what is involved. This is an area of BASIC
that few venture into. No special reason not to, except they don't know how.
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 4:17 am
by Danilo
oldefoxx wrote:One thing that some other IDEs do that can help someone get into writing a program
is the use of templates. A template is [...]
Menu: Tools > Templates
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 4:52 am
by oldefoxx
True. You have the IDE, and Tools/Templates. But it's empty. IMHO
there should be something there. You aren't expecting a beginner to
come up with his/her own templates off the bat, are you? This is
where someone more experienced can step in and help. I get an
empty box marked "crown jewels" delivered to my doorstep, it doesn't
mean much. And this is an empty box.
And while speaking of what is under Tools, I don't see anything that helps
you identify which of thw Windows API functions have been enabled to be
used with PureBasic without going through the formal process. They don't
seem to be listed anywhere. Now I can look up COORD with no problem, but
what about the functions that make use of these structures?
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 5:11 am
by Danilo
oldefoxx wrote:True. You have the IDE, and Tools/Templates. But it's empty. IMHO
there should be something there. You aren't expecting a beginner to
come up with his/her own templates off the bat, are you?
You are right. If you have some time, you could create some templates without writing code if you copy & paste
some help examples or PB examples into new templates. Console, DLL, GUI, Game Screen, ...everything there.
oldefoxx wrote:I don't see anything that helps you identify which of thw Windows API functions have been enabled to be used with PureBasic
Look for PureBasic\Compilers\APIFunctionListing.txt
BTW, you should add the Templates tab to the Tools Panel for quick access. You can do that in preferences:

Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 5:45 am
by idle
OldeFoxx please don't post off topic prose into sticky threads!
Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 5:54 am
by oldefoxx
Again good information to have. Would think that \PureBasic\Help
might be a good place for things like that. I guess I will copy it over
and see if I can access it that way.
I understand the concept of a Sticky Thread, idle, and yet I seem to
keep running into them. How am I suppose to know if a thread is
sticky or not? I mean if I see it up in the index area, it says Sticky.
But come on it another way, and there is nothing to tell me. I just
see Post Reply, so I do, if I have something to add.
Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 6:11 am
by Danilo
oldefoxx wrote:Again good information to have. Would think that \PureBasic\Help
might be a good place for things like that. I guess I will copy it over
and see if I can access it that way.
The directory PureBasic\Help\ is for external help files you may want to add to the help menu.
You copy .hlp and .chm help files into PureBasic\Help\ and open them from within the IDE with "Menu: Help > External Help >" (after restart of IDE)
If you put the famous old
Win32.hlp into PureBasic\Help\ you can press F1 on WinAPI commands like SendMessage_()
and it opens the Win32.hlp for the function.
If you have VisualStudio help installed on your system, you should install an IDE tool for opening this newer WinAPI help system.
IDE tools for this are available in the forum. For VS2010/WindowsSDK7.1 it is there:
[Editor Tool] VS2010 Help Integration
Having help at hand very quickly is important and key to success.

Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 6:16 am
by idle
OldeFoxx. The particular thread you posted in is a discussion on developing PureBasic documentation
So either post a question, could you add xyz? Or suggest an improvement to an existing part of the documentation!
It's not that hard to figure out what's appropriate to post in a thread if you read the Topic!
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 6:24 am
by oldefoxx
Danilo wrote:
BTW, you should add the Templates tab to the Tools Panel for quick access. You can do that in preferences:
Danilo, you really threw me a curve on this one. The image you show is nothing like my view of the IDE, and I see nothing related to setting Preferences anywhere. What am I missing?
I know I was posting on the topic of developing PureBasic documentation. I thought that was the point, to show where the existing documentation has gaps in it and give ideas on what might help make a difference. People have come forward with responses to the points I've made, saying where to find things (like look under Tools, check out a text file under \PureBasic\Compilers, and change my preferences (which I still don't understand)), and isn't that the
point? I get answers, other people read those answers, and somehow those answers should become part of the
documentation. I think it raises the question of whether this topic should have been set up as a Sticky in the first place, because it asks for ideas to be submitted.
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 6:28 am
by Danilo
oldefoxx wrote:Danilo wrote:
BTW, you should add the Templates tab to the Tools Panel for quick access. You can do that in preferences:
Danilo, you really threw me a curve on this one. The image you show is nothing like my view of the IDE, and I see nothing related to setting Preferences anywhere. What am I missing?
Menu: File > Preferences?
How does your IDE look like? Default PB install?
Re: PureBasic Docs- Ideas/Help needed for a "We start" chapt
Posted: Sun Sep 30, 2012 6:37 am
by idle
oldefoxx wrote:
I know I was posting on the topic of developing PureBasic documentation. I thought that was the point, to show where the existing documentation has gaps in it and give ideas on what might help make a difference. People have come forward with responses to the points I've made, saying where to find things (like look under Tools, check out a text file under \PureBasic\Compilers, and change my preferences (which I still don't understand)), and isn't that the
point? I get answers, other people read those answers, and somehow those answers should become part of the
documentation. I think it raises the question of whether this topic should have been set up as a Sticky in the first place, because it asks for ideas to be submitted.
I would suggest that you start your discussion in off topic or general discussion and if anything comes of it post those
questions or suggestions appropriately but don't hijack a thread with a discussion that's essentially prose.
I've nothing more to say on it.
Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 6:45 am
by oldefoxx
Fine. Since so many want to nitpick what I have to say or how I say
it, I will retire to the Off Topic section and let you all fuss about
that. Too much of a hassle to try to post anywhere else. What you
call "prose" is just putting thoughts into words, and I do think a lot.
Re: my first (in years) PureBasic program
Posted: Sun Sep 30, 2012 3:26 pm
by Danilo
@oldefoxx:
Did you already read
PureBasic Survival Guide - a tutorial for using purebasic for windows?
Could be interesting to you, as it has many infos and code examples for learning PureBasic.