With difficulty, I learned how to try and set up a Template in the IDE.
But it does not save, so I don't have the templates for use later.
Web searches turn up Softpedia download for "PureBasic Template
Standard Library". The download process does not identify what is
being downloaded, where it goes, or how to use them. There is
really no documentation available related to PureBasic and the
whole Template process.
Templates Not Working
Templates Not Working
Last edited by oldefoxx on Fri Oct 12, 2012 9:09 pm, edited 1 time in total.
has-been wanna-be (You may not agree with what I say, but it will make you think).
Re: Templates Not Working
If you use the portable mode, do you have directory write access rights?oldefoxx wrote:With difficulty, I learned how to try and set up a Template in the IDe.
But it does not save, so I don't have the templates for use later.
Works fine here: I click the first Icon ("New Template"), enter a name ("test") and in the
edit dialog i write some lines of code.
After restarting the IDE, the template "test" is still there and double click inserts the template code at the current cursor position.
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Templates Not Working
That description is far more than can be found in the PB help file:Danilo wrote:Works fine here: I click the first Icon ("New Template"), enter a name ("test") and in the
edit dialog i write some lines of code.
After restarting the IDE, the template "test" is still there and double click inserts the template code at the current cursor position.
"The templates tool allows you to manage a list of small code parts, that you can quickly insert into your source code with a double-click. It allows you to manage the codes in different directories, and put a comment to each code. This tool is perfect to manage small, often used code parts."
This sort of documentation is very unhelpful, because it takes up space without providing any details.
I realize that PB is cheap (or should I say inexpensive

We have jobs too, and aren't even responsible for PB, but our productivity has increased dramatically since we wrote our own help file. Surely improving the layout and content of the PB help file is not too much to ask, especially as PB is a mature product.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
~ Spike Milligan
Re: Templates Not Working
Ok, maybe the PB help could be better, but the system of templates is so simple and clear, that i don't need any helpline. With the help of the tooltips near everybody will check the system of templates in less then one minute. If i don't have adjusted my system to death, (in the most times) i don't need to know where and how the templates are saved. I use them and don't play with them, it's better to use this time for coding.
sorry for my bad english
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Templates Not Working
I agree with you that templates are fairly easy to figure out, but a lot of PB's features are not so easy, especially for programmers who don't have a lot of experience. One can tell this from the questions that are asked.
For example, because of our extensive experience with operating system internals and OOP, we've been able to put together a useful OOP facility using standard PB features. But less experienced programmers would have a hard time understanding prototypes and interfaces, and why they can be useful, from the descriptions that are in the documentation.
For example, because of our extensive experience with operating system internals and OOP, we've been able to put together a useful OOP facility using standard PB features. But less experienced programmers would have a hard time understanding prototypes and interfaces, and why they can be useful, from the descriptions that are in the documentation.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
~ Spike Milligan
Re: Templates Not Working
Okay. I tried it again, and this time worked. I went to %APPDATA%\PureBasic\Templates.prefs and found this as the new contents:
Where you see "\n" above, that is a new line flag, like using the Enter key.
If you don't recognize %APPDATA%, that holds "c:\Documents and Settings\<user name>\Application Data", which is a specific folder on your system. If you have PureBasic copied into another folder besides \PureBasic, it will
share what it finds in %APPDATA% with the original, unless you designate a different folder for Templates.
APPDATA is one of the environmental settings which you can check from the Command line by using "set", or
that you can check inside your program by using a set if functions whose names are:
Note that "set" is a good way to find the names and current values of all the environmental variables,
and if you did something like set APPDATA = \PureBasic\AppData you could change one, or do a
set APPDATA = with a blank after it, and you remove that variable from the set altogether. Not to be
played with lightly, although if you change the environmental variables in a program, once the program
is exited, the set is restored to what it was before the program was called.
Code: Select all
TEMPLATES:1.0
Template: Begin
Code: EnableExplicit\nGlobal a.l, b.l, c.l, d.l, e.l, f.l, g.l, h.l, i.l\nGlobal aa.s, bb.s, cc.s, DD.s, ee.s ff.s, gg.s\n\nProcedure.l rinstr(ofs.l, str1.s, str2.s)\n Protected a.l, b.l\n If ofs<1 Or ofs>Len(str1) \n a=Len(str1)+1\n Else\n a=ofs\n EndIf\n a-Len(str2)\n If a>0\n For b=a To 1 Step -1\n If Mid(str1,b,Len(str2))=str2\n ProcedureReturn b\n EndIf\n Next\n EndIf\n ProcedureReturn 0\nEndProcedure\n
If you don't recognize %APPDATA%, that holds "c:\Documents and Settings\<user name>\Application Data", which is a specific folder on your system. If you have PureBasic copied into another folder besides \PureBasic, it will
share what it finds in %APPDATA% with the original, unless you designate a different folder for Templates.
APPDATA is one of the environmental settings which you can check from the Command line by using "set", or
that you can check inside your program by using a set if functions whose names are:
Code: Select all
ExamineEnvironmentVariables() ;must be called first
Repeat
NextEnvironmentVariable() ;needs to be called, even for the first environmental variable
If EnvironmentVariableName() = "APPDATA"
Env.s = EnvironmentVariableValue()
Break
EndIf
Until EnvironmentVariableName() = ""
and if you did something like set APPDATA = \PureBasic\AppData you could change one, or do a
set APPDATA = with a blank after it, and you remove that variable from the set altogether. Not to be
played with lightly, although if you change the environmental variables in a program, once the program
is exited, the set is restored to what it was before the program was called.
has-been wanna-be (You may not agree with what I say, but it will make you think).
Re: Templates Not Working
The unanswered question is still, what is the story on the "PureBasic
Standard Template Library"? You know that the concept of a Template
can extend to many things, from cookie cutters to sketches that have
dimensions marked in like blueprints. But when they add "PureBasic",
it seems like they should be consistent with that feature built into the
PureBasic IDE. So this is still unsettled.
Looks to me like Templates could be such a useful tool that maybe
there ought to be something similar for handling the Include files.
As it is, the Include files are just mixed in with the other files and
you have to sort of sort (yeah, I know) them out manually.
Okay, I just sorted out the information on the "PureBasic Standard
Template Library". I used those exact words in a Google search, and
this time a new link popped up. In that link I found another link to
to the web site, and from there I followed the source file download
link to http://sourceforge.net/projects/pb-stl/files/
And these are not Template files, but Include Files. And there are
quite a few of them. I let WinRAR add the Include folder under
\PureBasic and just copied them in. Time enough to see what they
all are later. But it did answer that final question.
Standard Template Library"? You know that the concept of a Template
can extend to many things, from cookie cutters to sketches that have
dimensions marked in like blueprints. But when they add "PureBasic",
it seems like they should be consistent with that feature built into the
PureBasic IDE. So this is still unsettled.
Looks to me like Templates could be such a useful tool that maybe
there ought to be something similar for handling the Include files.
As it is, the Include files are just mixed in with the other files and
you have to sort of sort (yeah, I know) them out manually.
Okay, I just sorted out the information on the "PureBasic Standard
Template Library". I used those exact words in a Google search, and
this time a new link popped up. In that link I found another link to
to the web site, and from there I followed the source file download
link to http://sourceforge.net/projects/pb-stl/files/
And these are not Template files, but Include Files. And there are
quite a few of them. I let WinRAR add the Include folder under
\PureBasic and just copied them in. Time enough to see what they
all are later. But it did answer that final question.
has-been wanna-be (You may not agree with what I say, but it will make you think).