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
Highlighted
Developer
Posts: 190
Registered: ‎10-22-2009
My Device: Blackberry Torch
Accepted Solution

preprocessor doubt

Hi guys,

m havin problem using pre processor.

is there any thing like below possible

 

if define VAR1 & if undefine VAR2

....

endif

 

OR

 

if define VAR1

....

else if define VAR2

....

endif

 

Thanks

-----------------------------------------------------------------------------------
Please mark posts as solved if you found a solution. Press the kudos button to thank the user who helped you.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: preprocessor doubt

define? undefine? are you sure about travelling in java country?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 45
Registered: ‎06-23-2010
My Device: Not Specified

Re: preprocessor doubt

[ Edited ]

Here you can find preprocessor howto here.

 

Regards.

Developer
Posts: 190
Registered: ‎10-22-2009
My Device: Blackberry Torch

Re: preprocessor doubt

Hi Simon,

What i want to ask is there any variation possible than below

 

 

//#ifdef tag 
...
//#else
...
//#endif

 

//#ifndef tag 
... 
//#else 
... 
//#endif

My original problem is that i want to use the "pinch" available in OS 6 in my 4.7  touch code. But I m already using a preprocessor define for 4.7 touch as there still are devices which support os 4.6 and below which dont support touchevent and i now need to insert another preprocessor define inside it for 6.0 pinch.

 

//#ifdef OS47
touchevent() {
...
..
...
...
case TouchEvent.gesture:
   switch (touchevent.gesture) {
     //#ifdef OS60
      case Pinch:
          .....
          break;
     //#endif
   }
....
...
}

 

 

  I dont want to maintain different version of same file.

Any ideas/suggestions will be very helpful.

 

Thanks.

 

-----------------------------------------------------------------------------------
Please mark posts as solved if you found a solution. Press the kudos button to thank the user who helped you.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: preprocessor doubt

as far as i know you cannot nest preprocessor statements.

i would suggest that you use the numerical value of PINCH, this will make your code compatible to 4.7.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 190
Registered: ‎10-22-2009
My Device: Blackberry Torch

Re: preprocessor doubt

thats a nice idea, let me see if it could work. There is no reason why it shouldn't.

lets hope RIM ha maintain different integer value for this event.

Thanks.

-----------------------------------------------------------------------------------
Please mark posts as solved if you found a solution. Press the kudos button to thank the user who helped you.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: preprocessor doubt

i use this all the time, for example for blackberrycontact.work2 or no_system_menu_items and other flags that have been introduced in newer OS versions.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 190
Registered: ‎10-22-2009
My Device: Blackberry Torch

Re: preprocessor doubt

Hey, that worked !!

Thanks.

-----------------------------------------------------------------------------------
Please mark posts as solved if you found a solution. Press the kudos button to thank the user who helped you.