Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

New to Preprocessing directives

[ Edited ]

I'm having trouble getting preprocessing going with the Eclipse plug-in 1.1

 

Following the instructions in the config manual...

 

I have added osgi.framework.extensions=net.rim.ejde to the config.ini and restarted.

 

Then for preprocessing at the Project level, it says there should be a build tab on the application descriptor. But mine does not have one.

 

At the Workspace level, I do find the Preprocessor Directives and have added PREPROCESS, and VER_4.5.0. Restarted again just to be sure.

 

Now if I code something like this (using the examples in the Advanced UI example)...

 

I get an unreachable code error. And the app still blows up complaining about the Decor missing.

 

And where do I specify that VER_4.5.0 is only defines with JDK 4.5.0?

 

What am I missing?

 

//#preprocess

...

public int getPreferredWidth(){   	
	//#ifdef VER_4.5.0
		return _width;
	//#else
		return _width - this.getBorder().getLeft() - this.getBorder().getRight();;
	//#endif
}

 

Thanks

 

Developer
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: New to Preprocessing directives

[ Edited ]

Is this the correct way around it or am I just bypassing the real problem?

 

public int getPreferredWidth(){   	
	int _w = 0;
	//#ifdef VER_4.5.0
		_w = _width;
	//#else
		_w = _width - this.getBorder().getLeft() - this.getBorder().getRight();;
	//#endif
	return _w;
}    

 

 

Developer
Posts: 133
Registered: ‎04-30-2010
My Device: Curve 8520
My Carrier: T-Mobile

Re: New to Preprocessing directives

With a similar Eclipse and Plugin setup I am using

 

//#preprocessor

 

And

 

 

//#ifdef BlackBerrySDK4.6.0 | BlackBerrySDK4.6.1

 

//#elseif BlackBerrySDK4.7.0 | BlackBerrySDK5.0.0 | BlackBerrySDK6.0.0

 

//#endif

 

Succesfully

Developer
Posts: 264
Registered: ‎10-05-2010
My Device: Not Specified

Re: New to Preprocessing directives

But where is it defined that those are active at any given point?

 

I set my JRE to 4.5.0 and now Eclipse says that the getBorder is undefined... 

 

I'm missing something in the big picture.

 

And... The RIM Documentation only gives you half the picture. I'm sure it's technically correct for it says. But it does not say enough to be useful.

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: New to Preprocessing directives

Open the App Descriptor and choose the Build tab. That is where you can create/remove defines and enable/disable them.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.