BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   How to paste 100% FORMATTED Source Code In Your Forum Posts (http://www.blackberryforums.com/developer-forum/1360-how-paste-100-formatted-source-code-your-forum-posts.html)

Mark Rejhon 10-14-2004 10:26 PM

How to paste 100% FORMATTED Source Code In Your Forum Posts
 
How To Attach Source Code To Your Forum Posts

PHP Code:

Attaching source code is done by copy-and-paste.  Howeveryou need 
to 
do a special procedure.  When pasting source code in your posts in the 
Developer Forum
dont forget to put a "xxx91;codexxx93;" at the beginning of your 
source code
, and then a "xxx91;/codexxx93;" at the end of your source code.   This 
prevents the forum system from messing up your source code



Example #1: Messy Paste

import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener {
private Command exitCommand;
private TextBox tbox;

public HelloWorld() {
exitCommand = new Command("Exit", Command.EXIT, 1);
tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0);
tbox.addCommand(exitCommand);
tbox.setCommandListener(this);
}

protected void startApp() {
Display.getDisplay(this).setCurrent(tbox);
}

protected void pauseApp() {}
protected void destroyApp(boolean bool) {}

public void commandAction(Command cmd, Displayable disp) {
if (cmd == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}



Example #2: Correctly Done Paste

PHP Code:

xxx91;codexxx93;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class 
HelloWorld extends MIDlet implements CommandListener {
    private 
Command exitCommand;
    private 
TextBox tbox;

    public 
HelloWorld() {
        
exitCommand = new Command("Exit"Command.EXIT, 1);
        
tbox = new TextBox("Hello world MIDlet""Hello World!"250);
        
tbox.addCommand(exitCommand);
        
tbox.setCommandListener(this);
    }

    protected 
void startApp() {
        
Display.getDisplay(this).setCurrent(tbox);
    }

    protected 
void pauseApp() {}
    protected 
void destroyApp(boolean bool) {}

    public 
void commandAction(Command cmdDisplayable disp) {
        if (
cmd == exitCommand) {
            
destroyApp(false);
            
notifyDestroyed();
        }
    }
}
xxx91;/
codexxx93; 


myraddin 09-30-2008 03:32 AM

And how do we use colour in code ?
Can it be done automatically ?
Can we use [code=java] -> Edit: no we cannot :)

Edit:

I will answer myself :idea: :

use (y)"[php]" instead of (n)"[code]" -

(and no, "[java]" unfortunately does not work :cry:)


All times are GMT -5. The time now is 10:00 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.