Author Topic: Settings-editor-default code  (Read 10863 times)

Offline twilliam

  • Single posting newcomer
  • *
  • Posts: 3
Settings-editor-default code
« on: March 06, 2012, 01:06:23 am »
On the pull down menu Settings and then Editor and then "Default Code", would you explain how this is intended to be used please?
« Last Edit: March 06, 2012, 05:09:20 am by twilliam »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5341
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Settings-editor-default code
« Reply #1 on: March 06, 2012, 01:47:04 am »
I have created "default code" in Settings-Editor
What is the exact step you did? I can't understand your idea.

BTW: It looks like your need to use the project wizard to create a hello world project.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Settings-editor-default code
« Reply #2 on: March 06, 2012, 10:13:02 am »
On the pull down menu Settings and then Editor and then "Default Code", would you explain how this is intended to be used please?
Did you read the note below the textbox ?
Quote from: Settings -> Editor... -> Default code
The text you enter here, will appear on every new file (of the selected file-type) you create...

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Settings-editor-default code
« Reply #3 on: March 06, 2012, 10:23:06 am »
On the pull down menu Settings and then Editor and then "Default Code", would you explain how this is intended to be used please?
Did you read the note below the textbox ?
Quote from: Settings -> Editor... -> Default code
The text you enter here, will appear on every new file (of the selected file-type) you create...

By the way, you can use variables here, see: http://wiki.codeblocks.org/index.php?title=Variable_expansion

Offline twilliam

  • Single posting newcomer
  • *
  • Posts: 3
Re: Settings-editor-default code
« Reply #4 on: March 06, 2012, 02:37:23 pm »
Yes I did "read the note below the textbox" but it's not working that way.  When I open a new project
all I get in the CPP is:
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}
which is NOT the text I put in Default Code, again I ask "what am i doing wrong?"


On the pull down menu Settings and then Editor and then "Default Code", would you explain how this is intended to be used please?
Did you read the note below the textbox ?
Quote from: Settings -> Editor... -> Default code
The text you enter here, will appear on every new file (of the selected file-type) you create...

By the way, you can use variables here, see: http://wiki.codeblocks.org/index.php?title=Variable_expansion



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13235
    • Travis build status
Re: Settings-editor-default code
« Reply #5 on: March 06, 2012, 02:48:50 pm »
I guess the problem is that using a project wizard you don't create the file manually, thus the default code handler doesn't trigger.
What happens if you create a new file manually (with ctrl+shift+n or file-> new -> empty file)?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline twilliam

  • Single posting newcomer
  • *
  • Posts: 3
Re: Settings-editor-default code
« Reply #6 on: March 07, 2012, 02:19:01 am »
Yes, that worked, you solved the mystery, thank for the help!!

I guess the problem is that using a project wizard you don't create the file manually, thus the default code handler doesn't trigger.
What happens if you create a new file manually (with ctrl+shift+n or file-> new -> empty file)?